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

#1 2012-05-05 13:18:15

darif
New Scratcher
Registered: 2012-03-27
Posts: 20

Help with guns needed!

I'm making a game with an upgrade shop for different guns. Any ideas as to how I can give my character changeable weapons?
Eg. Press 1 for ak47 (5 damage)
     Press 2 for rpg (15 damage)
     etc

Offline

 

#2 2012-05-05 14:07:28

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Help with guns needed!

The easiest way to do it would be to create a variable (maybe called "gun").  When certain keys are pressed, certain values are assigned to the variable (i.e. pressing 1 sets "gun" to 1).  Then, if you have a sprite for all of the guns, have it switch to costume "gun" (1) which would be an ak47 for you  smile


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2012-05-05 15:53:19

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Help with guns needed!

^ that, in scratchblocks it'd be

when gf clicked
forever
  if <key [1 v] pressed>
    set [gun v] to [1]
  end
  if <key [2 v] pressed>
    set [gun v] to [2]
  end
  if <(gun) = [1]>
    change to costume [firstgun v}
  end
  if <(gun) = [2]>
    change to costume [secondgun v}
  end
end


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#4 2012-05-06 02:50:27

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: Help with guns needed!

zammer990 wrote:

^ that, in scratchblocks it'd be

when gf clicked
forever
if <key [1 v] pressed ?>
set [gun v] to [1]
end
if <key [2 v] pressed ?>
set [gun v] to [2]
end
switch to costume (gun)

Blocks fixed and improved.  big_smile

Last edited by jontmy00 (2012-05-06 02:50:43)


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#5 2012-05-07 07:50:47

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Help with guns needed!

Closed by request of the topic owner.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

Board footer