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

#1 2011-03-18 01:42:10

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Held a key?

Well, one of my first threads here in a long time.

I'm making a game where you must hold a key for a length of time.

If you don't hold it completely throughout the period, broadcast a. Also, it'll be like: press space in 3, 2, 1! And if you don't press it by then, you broadcast a.
If you hold it all throughout the period (1 sec) you broadcast b.

Some help here?

Offline

 

#3 2011-03-18 16:27:07

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Held a key?

It's truly much more complicated than that, I want something like:

there's a game where you have to press space for the three seconds where it shows the text "press space"

that's at a random time, and it'll say "press space in 3" all the way to 1.

And every time you hold it for that amount of time (it doesn't matter if you hold it before or after, but no other keys can be held after that.

If you don't hold it at any time when it goes, it fades to 50%, but still stays there for that amount of time.

Also, there are going to be 6 keys possible at a time, so you'll have to work this out with at least 2 keys...

Remember, no other keys than those can be pressed.

Not as easy as you think, right? That's why I'm asking, or else I wouldn't be asking...

Offline

 

#4 2011-03-18 16:30:30

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Held a key?

I suppose if you knew the framerate of your project you could convert how long you need into frames.

http://i53.tinypic.com/2prahc8.gif

Since the average framerate of a project is 40 fps, 40 frames is about 1 second.  This script will check if space is being pressed for that long.
You can change the i=40 to the next multiple of 40 for each second longer.  You can use any number really, but if you want to be exact, there you go.

Or do you need something more complex?

Last edited by Kileymeister (2011-03-18 16:32:29)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#5 2011-03-19 01:27:21

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Held a key?

Kileymeister wrote:

I suppose if you knew the framerate of your project you could convert how long you need into frames.

http://i53.tinypic.com/2prahc8.gif

Since the average framerate of a project is 40 fps, 40 frames is about 1 second.  This script will check if space is being pressed for that long.
You can change the i=40 to the next multiple of 40 for each second longer.  You can use any number really, but if you want to be exact, there you go.

Or do you need something more complex?

I suppose this would do...

if you have something else in mind, please show me!

Offline

 

#6 2011-03-19 01:41:32

ssss
Scratcher
Registered: 2007-07-29
Posts: 1000+

Re: Held a key?

this? 
1


Hey.  It's me SSSS, back from the dead!  smile

Offline

 

Board footer