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

#1 2012-02-17 21:04:06

HydroCity
New Scratcher
Registered: 2012-02-09
Posts: 35

Bug I Cant Seem to Fix. Please Help!

So im trying to make it so that when my Sprite goes to costume 6, the game waits 2 seconds, then stops as if it was a Game Over. But it seems to go to costume 7 (Power Up Costume) and continue on like nothing happened. Heres the Script:

when gf clicked
set [speed] to [-10]
set [Damage Taken] to [0]
set [Score] to [0]
switch to costume [costume1]
if on edge, bounce
go to x: (-202) y: (0)
set x to (-202)
show
if <(costume #)=[6]>
 wait (2) secs
 hide
 broadcast [end]
end
when I receive [HP]
 if <(costume #)=[1]>
  switch to costume [costume 7]
end
 if <(costume #)=[2]>
  switch to costume [costume 1]
end
 if <(costume #)=[3]>
  switch to costume [costume 2]
end
 if <(costume #)=[4]>
  switch to costume [costume 3]
end
 if <(costume #)=[5]>
  switch to costume [costume 4]
end
when I receive [Hit]
next costume
when I receive [End]
wait (0.1) secs
Stop all

Offline

 

#2 2012-02-17 21:41:52

laptop97
Scratcher
Registered: 2011-06-27
Posts: 1000+

Re: Bug I Cant Seem to Fix. Please Help!

Could you upload the project; the problem seems to be that when the HP broadcast is recieved, it will be switching costumes; then when the two seconds are done it will have a different costume. I need to know when HP is broadcasted  wink

Offline

 

#3 2012-02-17 21:49:46

HydroCity
New Scratcher
Registered: 2012-02-09
Posts: 35

Re: Bug I Cant Seem to Fix. Please Help!

Uploaded as Exce's Spacerun BUGGED ALPHA

Offline

 

#4 2012-02-17 21:59:15

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Bug I Cant Seem to Fix. Please Help!

That's because you aren't continually checking to see if it's costume 6.  smile  You will want to do something like this:

wait until <(costume #) = (6)>
wait (2) secs
hide
broadcast [end v]

Offline

 

#5 2012-02-17 22:02:59

HydroCity
New Scratcher
Registered: 2012-02-09
Posts: 35

Re: Bug I Cant Seem to Fix. Please Help!

It worked! Thanks for both your Help!

Offline

 

#6 2012-02-17 22:06:48

laptop97
Scratcher
Registered: 2011-06-27
Posts: 1000+

Re: Bug I Cant Seem to Fix. Please Help!

Aww... I was just about to post that. :P

Anyways, also add a    if <not(Costume #=6)>>     Around:

When I recieve [Hit]
When [up] key is pressed
When [down] key is pressed

;)

Last edited by laptop97 (2012-02-17 22:06:55)

Offline

 

#7 2012-02-17 22:14:09

HydroCity
New Scratcher
Registered: 2012-02-09
Posts: 35

Re: Bug I Cant Seem to Fix. Please Help!

kay, thanks again!  big_smile

Offline

 

#8 2012-02-17 22:17:49

HydroCity
New Scratcher
Registered: 2012-02-09
Posts: 35

Re: Bug I Cant Seem to Fix. Please Help!

kay, thanks again!  big_smile , it worked! I added a GAME OVER and intro screen, now uploading the BETA

Offline

 

Board footer