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

#1 2013-02-17 13:53:12

Jakemeister
New Scratcher
Registered: 2013-02-17
Posts: 6

Need urgent help with something somewhat simple?

Hello there, I am a 6th Form student in desperate need for some assistance with an issues I have ran into.

Problem: When bullets = 0, targets hit still registers points - Basically, my game is a target practise game where you shoot an M4 rifle at the targets that pop up. Now after so much time being put into the game, I cannot seem to fix a very simple issue. When there are no bullets left in the clip, when clicked on the target, it still registers it as a point; I have tried many different if statements, changing variables etc etc.

Please any help would be greatly appreciated.

Link to the scratch project: http://www.speedyshare.com/JRJEY/TARGET-PRACTISE.sb
Link to the scratch project virus scan: https://www.virustotal.com/en/file/bff520b11b5acc61ab12f62d8ba250e244de8f5152fa3f720919cdafea3ebe59/analysis/1361126747/

Thank you.

Offline

 

#2 2013-02-17 15:28:28

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Need urgent help with something somewhat simple?

The problem is that the bullets = 0 only affects one loop and all that loop controls is the sound effect, costume change and number of bullets. Add ifs to all of the loops required (all of the ones in the targets and the one in the aim sprite) to ensure that you need to have more than 0 bullets.


Also, the forever around the repeat until seems a bit redundant.

Last edited by Smozzick (2013-02-17 15:28:37)


http://i50.tinypic.com/ded8m.png

Offline

 

#3 2013-02-17 15:30:46

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Need urgent help with something somewhat simple?

Okay, I see what your issue is. You know how in your reticle (the targeting sprite), as well as in your targets, how you use this conditional?

(mouse down?)

Well that's what's causing your problems; there's nothing from preventing a shot with no ammo. So just change those into these:

<(mouse down?) and <(Bullets) > (1)>>

... and you should be good!

I hope that this helps!

Last edited by ErnieParke (2013-02-17 15:30:58)


http://i46.tinypic.com/35ismmc.png

Offline

 

#4 2013-02-17 21:08:03

bob6
Scratcher
Registered: 2010-07-01
Posts: 100+

Re: Need urgent help with something somewhat simple?

ErnieParke wrote:

<(mouse down?) and <(Bullets) > (1)>>

... and you should be good!

I hope that this helps!

He means

<(mouse down?) and <(Bullets) > (0)>>
tongue


http://i46.tinypic.com/3148ksz.gif

Offline

 

#5 2013-02-17 21:09:33

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Need urgent help with something somewhat simple?

bob6 wrote:

ErnieParke wrote:

<(mouse down?) and <(Bullets) > (1)>>

... and you should be good!

I hope that this helps!

He means

<(mouse down?) and <(Bullets) > (0)>>
tongue

Yes, yes I did, so thanks for pointing that out!

Last edited by ErnieParke (2013-02-17 21:09:41)


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer