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

#1 2009-09-29 23:00:48

wargameboy
Scratcher
Registered: 2009-09-29
Posts: 3

help!

i have a game that requires that only a constant pressing of a button on the key board will activate the timer (in other words when i press the button it runs when i let go it stops) how can i do this?

Offline

 

#2 2009-09-29 23:32:19

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

Re: help!

The timer cannot be stopped, but here's a code that could help you:

[blocks]
<when green flag clicked>
<set{ Timer }to( 0 )>
<forever if><key[ T ]pressed?>
<change{ Timer }by( 1 )>
<wait( 1 )secsc>
<end>
[/blocks]

Does this help?

Offline

 

#3 2009-09-30 13:00:42

wargameboy
Scratcher
Registered: 2009-09-29
Posts: 3

Re: help!

yes! it worked im creating a leval game and needed it because it needs to change levels when timer reaches certain number

Offline

 

#4 2009-09-30 13:38:40

wargameboy
Scratcher
Registered: 2009-09-29
Posts: 3

Re: help!

i have onother problem. how can you have a sprite do something if it is within a certain distance of another

Offline

 

#5 2009-09-30 17:59:03

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

Re: help!

[blocks]
<when green flag clicked>
<forever>
<if><distance to[ Sprite ]>
<move( 10 )steps>
<end>
<end>
[/blocks]

Just replace Move 10 Steps with what you want it to do.

Offline

 

#6 2009-09-30 19:06:44

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: help!

Edit@Magnie:
http://img14.imageshack.us/img14/7681/scripts.gif

Last edited by fg123 (2009-09-30 19:13:44)


Hai.

Offline

 

#7 2009-10-01 04:51:51

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

Re: help!

Thanks! ( You used BYOB ^.^ )

Offline

 

#8 2009-10-01 04:56:08

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: help!

ahhh, but if it is a large sprite, the distance to has to be altered, remember, distance to is not the distance to the outside of a sprite, but to the centre

Offline

 

#9 2009-10-01 05:00:04

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

Re: help!

True True True. ^.^

Offline

 

#10 2009-10-03 22:13:09

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: help!

Yup! ^.^


Hai.

Offline

 

#11 2009-10-03 22:38:54

RPGBaVB
Scratcher
Registered: 2009-08-18
Posts: 100+

Re: help!

Why not the timer be a variable?
Ex:
<{ Time (In Whatever) }>
You can stop a variable, riiight?


Scratcher & Photobucket Name: BaVB|  Youtuber Name: Superlazerfighter81 | Random Fact: Modern Warfare Two is the most frequently played game in the world right now. | A: B!  big_smile

Offline

 

#12 2009-10-05 03:11:56

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

Re: help!

It is.  big_smile

Offline

 

#13 2009-10-05 07:00:42

morkelkey
Scratcher
Registered: 2009-10-05
Posts: 3

Re: help!

I have a  problem in loading. If you have any suggestion for loading. Then please give me.

Offline

 

Board footer