This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-11-13 22:22:19

sapphireblue
New Scratcher
Registered: 2011-11-13
Posts: 4

inventory

hey guys i'm a young scratcher and i was wondering: i'm making a rpg and i want to know if there is a way to make it so that when you equip a new item your character changes sprites and gets more power but isn't a different character. please tell me because it's been really hard trying to figure it out. thanks!

Offline

 

#2 2011-11-14 03:53:03

Xzerie
New Scratcher
Registered: 2010-09-08
Posts: 11

Re: inventory

You may have to use variables and if-blocks to switch costumes around.

Im thinking of something like this in my head:

<if> itemX_equip = true
<switch to costume[ heroB
<set{ player_Power }to( ((  <{ base_Power }> <+> <{ itemX_power }> ))
<else>
<switch to costume[ heroA
<set{ player_Power  }to( <{ base_Power }>
<end>

Where, when you equip itemX, you switch to your 'upgraded' costume. Then set your power to what power you originally had PLUS whatever itemX's power is. Those two are added together to get your new power. BUT, if you don't have itemX yet, or you unequip it for some reason- you revert to your original not-quite-as-powerful-self and left with your original power.

I hope this helps somewhat and sorry if my explanation is too aggressive or confusing.

Offline

 

#3 2011-11-14 04:35:07

anuw
Scratcher
Registered: 2009-04-09
Posts: 50

Re: inventory

By sprites, do you mean costumes? If you think that a different sprite can make ur person stronger, then it isn't necesarilly the easiest way. You'd need a variable for power. (Like what Xzerie said) You can make it so that when ur 'attack' button is pressed, it'll deal <power> damage to enemy. (You'd also have a variable for health of enemy) Power could be set to the default when /= is pressed. When you touch and hold down mouse on a certain sprite (For buying that better gear) then it would change power by whatever amount neccesary. Then the upgrade sprite would hide so you couldn't keep upgrading your gear. Hope this helps. It's a little wordy, sorry. Just leave a message on one of my projects    http://scratch.mit.edu/users/anuw    if this wasn't the best response. Thanks!    ~Anuw


http://lolwut.com/layout/lolwut.jpg Lolwut?

Offline

 

#4 2011-11-15 09:34:37

sapphireblue
New Scratcher
Registered: 2011-11-13
Posts: 4

Re: inventory

thank you.

Offline

 

#5 2011-11-15 09:41:20

sapphireblue
New Scratcher
Registered: 2011-11-13
Posts: 4

Re: inventory

i was talking about the costume switching and also like when in mario for example you get a power up your character changes looks but also does something different. or maybe you get a new special sword so you gain in power but you can choose to have another weapon from your inventory.
like: http://scratch.mit.edu/forums/post.php?tid=80695#req_message http://scratch.mit.edu/forums/post.php?tid=80695#req_message cloud_power
http://scratch.mit.edu/forums/post.php?tid=80695#req_message mario_cloud
http://scratch.mit.edu/forums/post.php?tid=80695#req_message http://scratch.mit.edu/forums/post.php?tid=80695#req_message mario

Offline

 

#6 2011-11-17 01:53:07

anuw
Scratcher
Registered: 2009-04-09
Posts: 50

Re: inventory

Well for that sort of mario-mushroom effect just do

{forever if <touching colour (of power-up thing)>
{[change costume to ((costume #)+1)]
{(change [power] by (1)) }
~~~~~~~~~~~~~~~~~~~~~"

also when/if it gets downgraded:

{forever if <touching colour (of enemy)> and ([power]>1)
{[change costume to ((costume #)-1)]
{(change [power] by (-1)) }
~~~~~~~~~~~~~~~~~~~~~"

Hope it helps!  ~anuw


http://lolwut.com/layout/lolwut.jpg Lolwut?

Offline

 

Board footer