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

#1 2011-04-17 13:02:26

guyman55
Scratcher
Registered: 2009-05-23
Posts: 500+

Just wondering,

How do people script A charge attack (holding a button and then releasing it for a stronger attack)

Offline

 

#2 2011-04-17 13:12:01

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Just wondering,

I've never done this but I'd do this:

<when[ Key ]key pressed>
<reset timer>
<wait until> <<  <not> <key[ Key ]pressed?> >>
<set{ ChargeLevel }to( <timer> )>
<broadcast[ Attack ]>

Last edited by MoreGamesNow (2011-04-17 16:36:43)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#3 2011-04-17 15:02:36

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

Re: Just wondering,

I would do it like this:
http://i54.tinypic.com/s6kcr6.gif
Obviously the rate the power increases and the max power (the example is 100) can be changed as you please.


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

 

#4 2011-04-17 16:37:34

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Just wondering,

Kileymeister's script has the advantage of being able to be used by multiple sprites at once, while mine relies on a timer which is universal.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer