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

#1 2007-07-20 18:52:00

YAYALEC
Scratcher
Registered: 2007-07-19
Posts: 100+

how do i get my characters to shoot while i make a game

can you please help me


Smile likes to be happy. Smile also likes domination. Copy this message onto your signature and this Smile: =-). To help him Dominate the forums.

Offline

 

#2 2007-07-21 02:35:49

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: how do i get my characters to shoot while i make a game

Basically, you need a sprite (or sprites) to represent the bullets/arrows/whatever.

You need a way to tell to is sprite when to move, and in what direction, and how fast.

Then the bullet needs to know when it has hit the target or the edge of the screen, and the target needs to know it has been hit and react accordingly.

There are several different ways of doing this, and it depends on the nature of your game.

Have a look in my projects for anything titled Bow and arrow", "semaj's aeroplane game" or "multiple bullet demo" for some ideas.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#3 2007-07-21 23:34:02

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: how do i get my characters to shoot while i make a game

There is another, simpler approach to shooting: lasers.
For these, you just switch to a costume with the laser beam on, and detect the laser beam touching another sprite in any of a number of ways (position, color over color, sprite touching sprite, ...)    My son has done a number of simple shooting games this way, though none were ones he thought good enough to put up on the scratch web site.
We have one of them on our web site http://www.soe.ucsc.edu/~karplus/scratch_programs/ShootKevin.php

Offline

 

Board footer