How to make a DOOM CLONE in Unity || E1M5 Pick-ups and Billboards

SpawnCampGames
20 Jan 202115:06

Summary

TLDR本视频教程将指导观众如何为游戏角色创建三种可拾取物品:健康、护甲和弹药,并展示如何使用单一拾取脚本和对现有脚本的插槽修改来实现这一功能。接着,视频会介绍如何添加图形和实现广告牌效果,使用为该项目特别准备的免费资源。教程还会展示如何设置拾取物品的层级结构,添加必要的组件,编写脚本来检测玩家触发事件,并实现拾取物品对玩家健康、护甲和弹药的影响。此外,还会教授如何使用精灵和广告牌技术来增强视觉效果,最终将所有元素转化为预制件,方便在游戏世界中的部署。

Takeaways

  • 😀 视频介绍了如何为游戏玩家创建三种可拾取物品:健康、护甲和弹药。
  • 🛠️ 为了实现这一点,将使用一个拾取脚本和一些脚本插槽修改。
  • 🎨 视频还涉及了如何添加图形和广告牌效果。
  • 📚 项目中使用了一些免费的资源,这些资源可以在视频描述中的链接找到。
  • 📦 在层级结构中创建一个空的游戏对象,并将其命名为“item pickup”。
  • 🔍 为了分离逻辑和图形,向拾取对象添加一个3D对象作为子对象,用于视觉显示。
  • 🧩 通过添加一个box collider组件并设置为触发器,来处理碰撞检测。
  • 📝 创建并命名一个拾取脚本,用于检测玩家并根据拾取类型(健康、护甲或弹药)执行相应操作。
  • 🔑 通过在拾取脚本中声明布尔值和整数来区分拾取类型和数量。
  • 🔄 通过修改玩家健康脚本,实现增加健康和护甲的功能。
  • 🔗 在枪械脚本中添加弹药变量和方法,以便拾取弹药时更新弹药数量。
  • 🎭 使用精灵和广告牌技术,为拾取物品创建视觉效果,并确保它们面向玩家。

Q & A

  • 视频教程中要创建的三个物品分别是什么?

    -视频教程中要创建的三个物品是生命值(health)、护甲(armor)和弹药(ammo)。

  • 如何在游戏中设置物品拾取点?

    -在Unity的层级结构中创建一个新的空游戏对象,命名为物品拾取(item pickup),并将其变换重置到与玩家相同的位置。

  • 为什么需要将逻辑和图形分开?

    -将逻辑和图形分开是一种好的实践,有助于代码的管理和维护,使得游戏对象的功能和外观更容易控制和修改。

  • 如何为物品拾取点添加视觉效果?

    -在物品拾取点下添加一个新的3D对象作为子对象,这个子对象将作为拾取点的视觉效果。

  • 为什么需要移除视觉效果的碰撞器?

    -因为视觉效果仅作为展示,所有的碰撞检测应该在根物品拾取对象上进行,这样可以避免不必要的碰撞干扰。

  • 如何设置物品拾取点的碰撞器?

    -为物品拾取点添加一个组件,选择Box Collider,并设置为触发器(is Trigger),以便玩家可以进入触发区域。

  • 如何检测玩家是否触发了物品拾取?

    -在物品拾取脚本中使用OnTriggerEnter函数,通过检测other(其他)碰撞器的标签是否为'player'来判断玩家是否触发了拾取。

  • 如何为不同类型的拾取物品分配不同的变量和值?

    -在拾取脚本中声明三个public布尔变量分别代表生命值、护甲和弹药,以及一个public整型变量amount来表示拾取的数量。在Unity的检视器中为每个拾取点分配类型和数量。

  • 如何通过拾取点脚本修改玩家的生命值和护甲值?

    -通过在拾取脚本中调用玩家健康组件的giveHealth和giveArmor函数,并传递拾取的数量和拾取点的游戏对象引用。

  • 如何处理拾取点的销毁逻辑?

    -在拾取脚本中,如果玩家的生命值或护甲值小于最大值,就增加拾取的数量并销毁拾取点。如果达到最大值,则不销毁。

  • 如何为弹药拾取点编写脚本?

    -需要在枪械脚本中添加一个giveAmmo函数,该函数接收弹药数量和拾取点的游戏对象引用,并根据弹药数量更新枪械的弹药变量。

  • 如何将2D精灵图片设置为Sprite类型?

    -在Unity中选中精灵图片,然后在检视器中将纹理类型设置为Sprite 2D和UI,并应用更改。

  • 如何创建一个简单的广告牌效果?

    -创建一个Sprite Rotator组件,该组件在Update函数中使用Transform的LookAt方法,使其始终面向玩家。

  • 如何将物品拾取点转换为预制件?

    -在Unity中选中配置好的拾取点,重命名并设置其拾取类型和数量,然后拖拽到预制件文件夹中,使其成为预制件。

Outlines

00:00

😀 创建玩家可拾取道具

本段介绍了如何在游戏中创建玩家可以拾取的三种道具:生命值、护甲和弹药,以及它们的不同变体。目标是使用一个拾取脚本和一些脚本槽位修改来实现。接下来,视频中将展示如何添加图形和公告牌效果,并使用为该项目准备的免费资源。首先,通过在层级结构中创建一个新的空游戏对象并命名为“item pickup”,然后添加一个3D对象作为子对象来表示视觉效果。通过调整位置和大小,设置碰撞器,并编写脚本以检测玩家触发拾取事件,从而创建拾取道具。

05:02

🛠️ 拾取道具脚本编写与测试

这一部分详细说明了如何编写拾取道具的脚本,并通过Unity测试其功能。脚本中定义了布尔值和整数值来区分拾取道具的类型和数量。通过检测玩家标签,判断玩家是否触发了拾取,并在玩家生命值或护甲值低于最大值时,通过调用玩家健康脚本中的函数来增加生命值或护甲值,并销毁拾取道具。测试中发现,当玩家生命值已满时,拾取道具不应被销毁,因此对脚本进行了相应的调整。

10:02

🔄 弹药拾取与游戏对象引用

本段讲述了如何为弹药拾取编写脚本,并在Unity中进行测试。首先,需要获取玩家的枪械脚本组件,并调用一个新函数'give ammo'来增加弹药数量。在枪械脚本中,添加了弹药相关的变量和逻辑,确保在玩家弹药数小于最大弹药数时,可以通过拾取道具来增加弹药,并在弹药数超过最大值时停止增加。测试过程中,确保了拾取道具在玩家弹药已满时不会增加弹药,并且只有在玩家需要时才会销毁拾取道具。

15:03

🎨 制作与应用公告牌效果

这部分内容涉及了如何使用精灵图集来创建视觉效果,并为拾取道具添加公告牌效果。首先,在项目窗口中创建一个名为'sprites'的文件夹,并导入精灵图集。然后,为每个拾取道具创建一个3D四边形,并设置其为Sprite材质。通过为每个四边形分配不同的精灵图,创建了具有复古外观的拾取道具。接着,通过添加'sprite rotator'组件并编写脚本来实现公告牌效果,使得拾取道具始终面向玩家。最后,将拾取道具转换为预制件,以便在游戏世界中的任何位置快速使用。

🎬 结束语

视频的结尾部分,作者提醒观众保持关注,以便继续观看后续系列视频。

Mindmap

Keywords

💡拾取物品

拾取物品是游戏中常见的机制,允许玩家通过与游戏世界中的物体交互来获得奖励或能力提升。在视频中,制作者介绍了如何为玩家创建三种可拾取的物品:健康、护甲和弹药,并展示了如何通过脚本和游戏对象设置来实现这一功能。

💡游戏对象

游戏对象是Unity中用于构建游戏场景的基本单元,可以包含模型、动画、脚本等组件。视频中提到创建一个新的空游戏对象,并命名为'item pickup',作为拾取物品的基础。

💡触发器

触发器(Trigger)是一种特殊的Unity Collider,用于检测游戏对象是否进入或离开某个区域,而不会实际阻止对象的移动。视频中通过将拾取物品的Collider设置为Trigger,使得玩家可以穿过拾取物品来触发事件。

💡脚本

脚本是Unity中用于控制游戏逻辑的代码文件。视频中提到创建并使用'item pickup'脚本来检测玩家是否触发了拾取物品,并根据拾取物品的类型(健康、护甲或弹药)来执行相应的逻辑。

💡玩家标签

在Unity中,标签(Tag)用于标识和分类游戏对象,便于脚本中进行识别和处理。视频中提到确保玩家对象被正确标记为'player',以便脚本能够识别并触发拾取物品的效果。

💡公共变量

公共变量(Public Variables)是Unity脚本中可以被Unity编辑器直接访问和修改的变量。视频中通过在拾取物品脚本中声明公共布尔值和整数变量,允许在Unity编辑器中为不同类型的拾取物品分配不同的效果和数值。

💡组件

组件(Component)是附加到Unity游戏对象上的脚本或功能模块,如Collider、Script等。视频中多次提到添加组件,如为拾取物品添加Box Collider组件,以及为视觉对象添加Sprite Renderer组件。

💡精灵

精灵(Sprite)是2D图像,常用于制作游戏的视觉效果。视频中提到使用精灵作为拾取物品的视觉表现,并介绍了如何将精灵导入Unity、设置为Sprite类型,并应用到3D Quad上。

💡预制件

预制件(Prefab)是Unity中的一种资源,允许开发者创建可重复使用的游戏对象配置。视频中展示了如何将配置好的拾取物品转换为预制件,以便在游戏世界中快速部署。

💡精灵旋转器

精灵旋转器(Sprite Rotator)是视频中自定义的一个组件,用于实现精灵的billboard效果,即无论玩家从哪个角度观察,精灵始终面向玩家。这增强了游戏的视觉表现,使得拾取物品更加醒目。

Highlights

本视频将制作三种可拾取道具:生命值、护甲和弹药,尝试使用一个拾取脚本和一些插槽修改。

使用Unity中的空GameObject创建拾取道具,并将其命名为'item pickup'。

为拾取道具添加3D对象作为子对象,用于显示视觉效果。

拾取道具的视觉效果应放置在地面上并位于玩家前方。

为root item pickup对象添加box collider组件,设置为触发器。

编写item pickup脚本,用于检测玩家并响应拾取事件。

脚本中使用'OnTriggerEnter'函数来检测玩家是否触发拾取。

通过比较标签(tag)来确认触发拾取的是玩家。

声明三种公共布尔值变量,分别代表生命值、护甲和弹药拾取。

在拾取脚本中,根据拾取类型调用玩家健康脚本的'give health'或'give armor'函数。

为防止生命值或护甲超过最大值,设置检查并限制最大值。

在玩家健康脚本中,根据拾取道具的类型增加生命值或护甲值。

创建弹药拾取道具时,需要调用枪械脚本的'give ammo'函数。

在枪械脚本中添加弹药变量,并在射击时扣除弹药。

创建sprites文件夹,并将自定义的拾取道具图像导入Unity。

使用3D Quad替换默认的拾取道具视觉效果,并调整大小以匹配触发器。

为每个拾取道具的视觉效果添加sprite rotator组件,实现billboard效果。

将拾取道具和sprite rotator脚本转换为Prefab,方便在场景中复用。

最终,演示了如何将拾取道具放置在游戏场景中,并确保它们已经具备功能且外观良好。

Transcripts

play00:03

hello everyone

play00:04

in this video we'll be making pickup

play00:05

items for our player we're going to have

play00:07

three items that our player can pick up

play00:08

that being health armor and ammo

play00:11

and we'll have variations of each and

play00:12

we'll try to do it all with one pickup

play00:14

script

play00:14

and some slot modifications to our

play00:16

current scripts

play00:17

we'll then get into adding some graphics

play00:19

and a billboard effect

play00:21

in this video we'll use some assets that

play00:22

i threw together just for this project

play00:24

and they're free for you to use also the

play00:27

links in the description

play00:29

so let's get to it

play00:33

let us start by setting up one pickup in

play00:36

the hierarchy we're going to create a

play00:37

new empty game object

play00:38

and we'll name it item pickup for now

play00:41

reset is transformed so it's here at the

play00:43

same spot as our player

play00:45

it's good practice to separate out your

play00:47

logic and graphics so on the item pickup

play00:50

we're going to add a new 3d object as a

play00:52

child

play00:53

and this will be our visuals for the

play00:55

time being

play00:56

let's select the whole object and just

play00:58

drag it up even with the ground

play01:00

and in front of the player so we can see

play01:02

it

play01:03

we'll select the visual again and let's

play01:06

just remove the collider

play01:08

the visual is only a visual and any

play01:10

collision detection going on will be on

play01:12

our root item pickup object

play01:14

so now let's just select it and we'll

play01:16

add a component

play01:18

and it'll be a box collider let's make

play01:20

it a bit larger than the visual

play01:22

so we'll say 2 on the x 2 on the y and 2

play01:25

on the z

play01:26

and since it's a trigger volume and we

play01:28

don't want any

play01:29

actual collision stopping us we'll take

play01:32

this to

play01:32

is trigger so now our player can enter

play01:35

the trigger so let's add a script and

play01:37

set up some detection

play01:40

let's add a new component to our pickup

play01:42

and it'll be a script that we name

play01:44

item pickup and press enter twice or

play01:46

click

play01:47

create and add and let's move it into

play01:50

the scripts folder

play01:52

and then we'll double click it to open

play01:53

it in visual studio

play01:57

to detect the player we want to go

play01:58

beneath this update and say

play02:00

void on trigger enter and this takes him

play02:03

a collider called other and then now

play02:06

we'll use that to see if the player

play02:08

has triggered it by saying if other dot

play02:10

compare tag

play02:13

and we'll use the tag player

play02:17

and for this to work make sure your

play02:19

player is still correctly tagged as

play02:21

player

play02:23

so starting simple if other is player

play02:26

then we want to destroy the game object

play02:30

now we can do a quick save and test in

play02:32

unity

play02:33

yep it appears to be working so as i

play02:36

mentioned before we're gonna use the

play02:37

script for our three main types of

play02:39

pickups

play02:40

up at the top i'm gonna declare three

play02:42

public bulls

play02:43

they're gonna be his health is armor

play02:47

and is ammo and lastly we'll declare a

play02:50

public int

play02:52

and we're just going to call this amount

play02:56

now we can use this script on multiple

play02:58

pickups and we can assign what type and

play03:00

value here in the inspector

play03:03

now inside the if statement that checks

play03:05

for our player we'll add three more to

play03:07

check what type of pickup we have

play03:09

and we'll be using if is health if is

play03:12

armor and if is ammo

play03:16

we'll deal with our health pick up first

play03:18

if we navigate to our player and open

play03:20

the player health script you'll see we

play03:22

have what we need right here

play03:23

we have our health variable and also we

play03:25

have our armor variable

play03:27

but also notice their protection level

play03:29

is private so to modify these we'll do

play03:31

it through a function that we call from

play03:33

the pickup script

play03:35

we can scroll down here to the bottom

play03:37

and collapse the damaged player function

play03:39

and beneath it we'll write out this new

play03:41

function we'll say

play03:42

public void give health and have it take

play03:46

in an

play03:46

end it will call amount and let's also

play03:49

attend to the armor by

play03:50

duplicating this function and instead

play03:53

we're just going to call this one

play03:54

give armor

play03:57

since these are public we can now call

play03:59

them from within the pickup script

play04:01

but first we need to grab the player

play04:03

health component we can do that by

play04:05

saying

play04:06

our other dot get component and we want

play04:09

player health and now we can access the

play04:12

function with dot

play04:14

give health and for the amount we'll

play04:16

pass in our pickup amount

play04:17

and that's this guy here and we can copy

play04:20

and paste this

play04:21

into our if is armor and instead

play04:24

we'll call the give armor function

play04:29

now that should call one function or the

play04:30

other depending on the pickup type

play04:33

let's go back into the playerhealth

play04:34

script and make these actually do

play04:36

something

play04:37

in the give health function we'll just

play04:39

say health plus equals amount

play04:42

for now and the same for armor only

play04:45

armor plus equals amount instead and in

play04:48

case our pickups increase our health

play04:49

over our max health allowed then we'll

play04:51

set our health back to our max health

play04:54

and we'll do the same for armor

play04:58

so now we can save and jump into unity

play05:00

for a quick test

play05:02

i'm going to set this pickup to be

play05:03

health and the amount we'll use 30 to

play05:06

test

play05:07

and i'll duplicate it a couple of times

play05:09

so now we can select our player

play05:11

and go down to our player health script

play05:13

and then the inspector will set this to

play05:14

debug

play05:15

so we can take a peek i'll hit play and

play05:18

then i'm going to hit our

play05:19

right shift that damages our player a

play05:21

couple of times

play05:22

so now you can see their health is down

play05:24

to 60 so we go over our first pickup and

play05:26

it goes to 90.

play05:28

so we go to our second pickup and it

play05:31

goes to 100

play05:32

so it can't go over 100 that's good but

play05:35

now when we go to our last pickup it

play05:38

stays at 100 but the pickup

play05:39

disappears so if we're at 100 we don't

play05:42

want this pickup to be destroyed

play05:44

i'm going to set this debug to normal

play05:46

mode and then we'll jump back in our

play05:47

scripts

play05:49

so in our pickup script we're going to

play05:51

remove this destroy game object

play05:53

and instead we're going to have our

play05:55

player health determine whether or not

play05:57

the pickup gets destroyed

play06:00

so in here instead of the amount being

play06:02

added every time this function is called

play06:04

we want to check if we even need

play06:06

it so we can say if our health is less

play06:09

than

play06:09

max health then we want to add our

play06:11

pickup amount to our health

play06:14

then we know if we added the health then

play06:16

we need to destroy the pickup but to

play06:18

destroy it from here we need

play06:20

a reference to it so where we pass in

play06:22

the amount will also pass in a game

play06:24

object

play06:24

we'll call it pickup and then down here

play06:27

we'll just say destroy

play06:29

the pickup if we go back into our pickup

play06:32

script now you'll notice that it's

play06:33

complaining because this give health

play06:35

call is now expecting a game object

play06:37

so next to our amount we'll just type

play06:40

game object

play06:41

that's whatever object that the script

play06:43

is attached to

play06:45

so back in our player health we'll do

play06:47

the same process for the give armor

play06:49

function

play06:51

we'll say if armor is less than max

play06:54

armor

play06:54

then we want our armor plus equal to our

play06:57

mount

play06:58

and then we want to also destroy a

play07:00

pickup

play07:01

and then up here next to our amount

play07:03

we'll pass in

play07:04

a game object called pickup and once

play07:06

more inside of our pickup script

play07:08

we'll pass in our game object

play07:13

and just to be a little more clear we'll

play07:15

say these are

play07:17

this dot game object so now if we save

play07:20

all of our scripts and go into unity and

play07:22

play test

play07:23

we'll make the same scenarios before and

play07:26

you'll see that the third pickup no

play07:28

longer disappears because we can't use

play07:30

it and if i make an armor pick up real

play07:32

quick you'll see that i can't actually

play07:34

pick it up

play07:35

until i damage the player first but that

play07:37

reminds me

play07:38

we don't want our player to start with

play07:39

any armor so in our player health script

play07:41

let's scroll up to our start function

play07:43

and remove this line where it says set

play07:45

armor to max armor

play07:47

now we can save and start on our ammo

play07:49

pickup

play07:50

so for ammo it's similar to this git

play07:52

component call but for our player health

play07:54

it's on the root

play07:56

for this we'll be needing our gun script

play07:58

and as you can see

play07:59

it's a child of our player so here we'll

play08:02

say

play08:02

other dot and we're looking for get

play08:04

component in children

play08:06

and the component we want is gun and

play08:09

we'll call a similar function to these

play08:11

others

play08:12

but this one will name give ammo

play08:15

and it's also going to take an amount

play08:18

and it's going to pass in

play08:19

this game object now let's create this

play08:21

function in our gun script so we'll

play08:23

navigate to our player

play08:24

and the gun game object and double-click

play08:26

our gun script to open it up

play08:28

so we already have a fire rate and some

play08:30

damage variables

play08:31

but let's add an ammo variable beneath

play08:33

the next time to fire we want a public

play08:35

int

play08:35

max ammo and a private int called ammo

play08:41

next we want to move to our update and

play08:42

in our if condition

play08:44

we need to add in

play08:47

and our ammo is greater than zero so

play08:50

then you can fire if we have ammo and

play08:53

then down

play08:54

inside of our fire at the very end we'll

play08:56

deduct our ammo

play08:57

by saying ammo minus minus

play09:00

and this will subtract one ammo now we

play09:03

can collapse this fire method

play09:05

and write our new function down below it

play09:08

and since we know how this is structured

play09:09

now we can just write it all out

play09:11

we'll say public void and we're going to

play09:13

say give

play09:14

ammo and then it's going to be int

play09:17

amount game object pickup

play09:21

and then we're going to say if ammo is

play09:23

less than max ammo

play09:25

ammo plus equal amount and then we're

play09:28

going to destroy

play09:29

pickup and then we're going to say if

play09:32

ammo

play09:33

is greater than our max ammo then we

play09:35

need to set ammo

play09:36

equals max ammo

play09:41

so if we save that and go check our

play09:42

pickup script all of our functions are

play09:44

happy

play09:45

so we can go into unity and we're going

play09:47

to finish off the system by setting our

play09:49

max ammo and our gun script

play09:51

and i'll just use 100 here

play09:59

we'll start with just one pickup and

play10:00

we'll make sure that all the variables

play10:02

are zeroed out

play10:05

now let's create a new folder inside of

play10:07

our project window and we're gonna call

play10:08

it sprites

play10:10

and i'm gonna drag my sprotts in and

play10:12

these are the ones from the link in the

play10:13

description

play10:14

but feel free to use your own

play10:18

after i get them in here i'm going to

play10:20

control click and select all of them

play10:23

in the inspector i'm going to set the

play10:25

texture type to sprite 2d and ui

play10:28

and scroll down and click apply to

play10:30

change them all

play10:34

so on that first pickup we made let's

play10:35

delete the visual we have now

play10:39

and instead we'll add a 3d quad

play10:44

we'll name this visual and remove its

play10:46

collider as we did the cubes

play10:48

and we'll scale it up a bit maybe two on

play10:51

the x and two on the y

play10:54

and now it kind of matches up with our

play10:55

trigger volume

play10:57

let's grab it and pull it out the ground

play10:59

a little bit now that's the backbone of

play11:01

all of our prefabs so let's duplicate

play11:03

this six times

play11:04

or however many sprites you're using i

play11:06

agree this feels janky but i've had

play11:08

trouble with quads and swapping

play11:09

materials before

play11:10

so each sprout is going to get its own

play11:12

blank quad so once you have all of these

play11:15

and they're spread out a bit we're going

play11:16

to expand them all so we can see the

play11:18

visual object

play11:20

then we'll just select the first quad

play11:23

visual

play11:24

and for this one i'm going to use the

play11:25

big med kit so i'm just going to drag

play11:27

this

play11:28

on and then here in the material i'm

play11:31

going to change the shader

play11:32

to sprite and default

play11:37

then you pretty much just rinse and

play11:39

repeat with all of your sprites

play11:43

so on the smaller meg kit the scale is

play11:46

just a little too big so i'm gonna go

play11:47

ahead and change it to one

play11:49

and one and then i also ended up doing

play11:52

that

play11:52

on the small armor and both of the ammo

play11:56

pickups

play12:02

so now we got some nice retro looking

play12:04

pickups but now let's use billboarding

play12:06

textures to make it more

play12:08

doom-like so we're going to select one

play12:11

of our visual quads

play12:12

it doesn't matter which one and we're

play12:14

going to add a component

play12:15

and we're going to call it sprite

play12:17

rotator

play12:19

and then we'll just double click it open

play12:20

it up making a basic billboard script is

play12:23

really easy

play12:24

in our update we're going to take this

play12:26

transform and say

play12:27

dot look at and this is a built-in unity

play12:29

function that takes in a transform

play12:32

we'll name ours the same as theirs with

play12:36

target

play12:38

and then at the top we'll declare a

play12:40

private transform name

play12:41

target and then in the start we'll

play12:44

assign the target by finding our

play12:45

player's transform by using

play12:47

find object of type and then we'll look

play12:50

for

play12:50

player move since we know that's on our

play12:53

player

play12:58

and then we'll say dot transform

play13:02

and that's pretty much it you can save

play13:03

and go back into unity

play13:09

now we can apply it to all the other

play13:10

ones so we can hold ctrl and we'll

play13:12

select

play13:12

all the other visuals and then we'll

play13:15

just hit add component

play13:16

and then add our new sprite rotator

play13:21

so this point in the video i realized

play13:23

that the pickups that i was working on

play13:24

was missing the pickup script so i'm

play13:27

just going to select

play13:28

all the pickups and i'm going to add the

play13:31

pickup script to it

play13:34

now we can finally turn these into

play13:36

prefabs and doing so is a bit grindy but

play13:39

pretty simple we'll select our first one

play13:41

here

play13:42

and what we need to do is name it we'll

play13:44

name this one big meg kit

play13:45

and then we'll pick what kind of pickup

play13:47

it is and then i want this one set as

play13:49

50. after that is pretty much copy and

play13:52

paste

play13:54

the small meg kit i used 10 for the big

play13:56

armor

play13:57

i used his armor and 25

play14:01

and then for the small armor i used five

play14:04

the big ammo

play14:05

is ammo and it's set to 10 and the small

play14:08

ammo i have set

play14:09

to 5. now they're sorted out we can go

play14:12

down in our project window and we're

play14:13

going to move our sprite

play14:15

rotator into the scripts folder and

play14:17

we're going to go into the prefab folder

play14:19

and we're going to create a new one

play14:20

called pickups now let's use ctrl click

play14:23

to select all of our prefabs here

play14:27

and then inspector we're going to go and

play14:29

we're going to reset the position

play14:31

and then we'll drag h1 into our prefab

play14:34

folder

play14:35

and that will make them prefabs and once

play14:37

it's a prefab you can delete it out of

play14:39

the scene

play14:43

and then you'll see that we're able to

play14:46

just grab

play14:47

any pickup we want and just slap it

play14:50

anywhere we want in our game

play14:56

and they're already functioning and they

play14:58

look great

play15:00

well that's about it for this video i

play15:02

hope you stay tuned and catch more of

play15:03

the series

play15:04

spine camp out

Rate This

5.0 / 5 (0 votes)

Related Tags
Unity教程游戏开发拾取系统玩家健康护甲增强弹药补给触发器脚本编程游戏资产视觉效果
Do you need a summary in English?