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

#1 2012-05-17 16:42:54

Gokurox296
Scratcher
Registered: 2012-01-08
Posts: 48

need help with time in a battle game

i tried this

when i receive
Begin!
show variable
time
If
time
120>
broadcast
Game over
and wait
else
forever
wait
1
secs
change
time
by 1

i tried this and many other things but when i do the thing to broadcast "Begin!" only for 1 second my battle screen shows then the game over thing where it goes back to menu appears!
help?  sad


Clicky Clicky:http://scratch.mit.edu/forums/viewtopic.php?pid=1199265#p1199265

Offline

 

#2 2012-05-17 18:41:09

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

Re: need help with time in a battle game

Try this:

when I receive
Begin!
reset timer
show variable
time
forever
set
time
to
round
timer
if
timer
>
120
broadcast
Game over
and wait

Hope that helps!

Last edited by AtomicBawm3 (2012-05-17 18:41:47)


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

Offline

 

#3 2012-05-17 18:44:59

backspace_
Scratcher
Registered: 2012-03-21
Posts: 500+

Re: need help with time in a battle game

AtomicBawm3 wrote:

Try this:

when I receive
Begin!
reset timer
show variable
time
forever
set
time
to
round
timer
if
timer
>
120
broadcast
Game over
and wait

Hope that helps!

this will work ^
the problem with your script is that you're forgetting a forever loop, so it only asks itself "time>120?" once. You need a forever for it to keep asking itself the statement.


Your tiny hands
Your crazy kitten smile

Offline

 

#4 2012-05-17 18:51:00

Gokurox296
Scratcher
Registered: 2012-01-08
Posts: 48

Re: need help with time in a battle game

thanks guys i'll try it soon...also do you know how to make it so a sprite can collide with something and won't move through it?


Clicky Clicky:http://scratch.mit.edu/forums/viewtopic.php?pid=1199265#p1199265

Offline

 

#5 2012-05-17 22:04:53

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

Re: need help with time in a battle game

Gokurox296 wrote:

thanks guys i'll try it soon...also do you know how to make it so a sprite can collide with something and won't move through it?

That's pretty general question...the general answer is:

if
key
up arrow
pressed?
move
4
steps
if
touching
wall
?
move
-4
steps

You can replace the move block with any method of movement you want...this is not the only way to do this, but it's one of the simpler ways.


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

Offline

 

#6 2012-05-18 17:47:36

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: need help with time in a battle game

You've always got to make sure to reset your variables, or things will happen that aren't supposed to. Hope your game turns out well!  smile


Why are the secret organizations getting all the attention?  mad

Offline

 

Board footer