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

#1 2010-07-01 00:58:14

Royah
Scratcher
Registered: 2009-12-24
Posts: 3

Modern Shooter Game Help

I am creating a shooter game that is top view playing type. I'm not using any scrollers for there will be A.I.(that I have not scripted yet) and I fear it would be too difficult. But I recently came across a problem with the damage system that I was planning.

Now, in my game, There are different stages to play on. I have made a sprite that acts as obstacles, and the background changes for every stage. I put in sensors so you could not walk through the obstacles. So the problem is... the way the weapons fire in the game were made very differently so that auto fire could be possible without any delay. What they do is actually just appear and then disappear almost instantly. Now, what I was planning(which means I haven't actually scripted it yet) was when the bullet is touching an enemy, but is also touching a wall, the enemy will not take damage.
Here is an image to show what I mean and where the problem is at:
http://i280.photobucket.com/albums/kk195/supanova999/Apictuuuure.png

If you want a better understanding on what I mean, please download the latest update I uploaded of this game on my profile:

http://scratch.mit.edu/projects/Royah/1159090

Note that the A.I. and the damage system have NOT been scripted yet.

If you could please help me that would be great.

Again, I need to find a way so that a person in front of cover will take damage when the bullet touches him, even if the bullet is touching an obstacle, but if he is behind the obstacle, he won't take any damage.

Thanks.

Also note that the game is no where close to being finished. This is just a problem that needs to be fixed in order for me to continue.

Last edited by Royah (2010-07-01 01:04:49)

Offline

 

#2 2010-07-01 02:22:23

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Modern Shooter Game Help

Wow, nice picture! That really helps.  smile

Hmm... maybe if each obstacle were a separate sprite, you could check if the distance to the green enemy is less than the distance to the obstacle - but the script would need to work out what enemy and what obstacle it needs to check.

If you had a small sprite zoom across the screen, it could record all the enemies it hits and stop once it hits an obstacle. It wouldn't be related to the way you're having bullets fire, but it might work.

http://img526.imageshack.us/img526/6576/254bulletscriptthatchec.png

It works by going across the screen and recording what enemies it hits. It stops when it hits an obstacle, so it won't record any enemies behind obstacles.

If you don't want to create three variables for checking if the enemies have been recorded yet, you can use three items in a list.

Last edited by Jonathanpb (2010-07-01 02:23:23)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#3 2010-07-01 03:25:36

Royah
Scratcher
Registered: 2009-12-24
Posts: 3

Re: Modern Shooter Game Help

Jonathanpb wrote:

Wow, nice picture! That really helps. :)

Hmm... maybe if each obstacle were a separate sprite, you could check if the distance to the green enemy is less than the distance to the obstacle - but the script would need to work out what enemy and what obstacle it needs to check.

If you had a small sprite zoom across the screen, it could record all the enemies it hits and stop once it hits an obstacle. It wouldn't be related to the way you're having bullets fire, but it might work.

http://img526.imageshack.us/img526/6576 … atchec.png

It works by going across the screen and recording what enemies it hits. It stops when it hits an obstacle, so it won't record any enemies behind obstacles.

If you don't want to create three variables for checking if the enemies have been recorded yet, you can use three items in a list.

Thanks for your help.

I actually thought of your first idea, but after an experiment, I actually confused myself and thought it wouldn't work. I just tried again and it seems like it works. I might come back, however, if I come across another similar problem, but for now, thanks for your help : )

Offline

 

#4 2010-07-01 08:07:32

Subh
Scratcher
Registered: 2010-05-25
Posts: 100+

Re: Modern Shooter Game Help

i'll say welcome from his side (he forgot MANNERS  tongue   wink  )


http://wiki.scratch.mit.edu/skins/scratch/logo.png     I'M IN Scratch Wiki .... ARE YOU ????

Offline

 

#5 2010-07-01 14:06:25

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: Modern Shooter Game Help

what if u just have the bullet hide when it hits the obstacle (i dont know if this works its just a teory) so it would be like
[blocks]<when green flag clicked><if><touching color[ <hide><stop script>


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

Board footer