The Daily Click ::. Forums ::. Klik Coding Help ::. quick question
 

Post Reply  Post Oekaki 
 

Posted By Message

Tiri



Registered
  16/01/2004
Points
  78
15th May, 2004 at 03:03:13 -

god im probably gonna sound like a noob for asking this question but i would like to know how to get my 2d side scrolling character to start running after i double tap the arrow key i have tried a few ways but none work..someone please help me

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
15th May, 2004 at 03:15:09 -

Here's one way:


*Pressed right - counter.val = 100
+ Counter.val <= 0.

*Every 0.10 secs - subtract 1 from counter

*Pressed right - Run, Set counter to 0
+ Counter.val > 0.


There you go! Okay here's how it works:
When you press right you start a counter that counts down from 100. If the player presses right again before this counter reaches 0 then you program the character to run. Then you just repeat the events for the left side.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
15th May, 2004 at 05:52:03 -

100 is a bit too high tho. Surely that would give 10 seconds to tap the second time

 
n/a

ChrisB

Crazy?

Registered
  16/08/2002
Points
  5457
15th May, 2004 at 06:17:25 -

Also, don't use Every events, use Always instead (and set the counter higher). Stops stuff messing up if your player hits Alt by 'accident'.

 
n/a

Lazernaut



Registered
  08/09/2002
Points
  1103

VIP MemberThe Cake is a LieIt's-a me, Mario!Wii OwnerPokemon Ball!
15th May, 2004 at 07:04:42 -

In these sorta things i always go with "if counter is greater or equal to 1, then subtract 1"..that way, cpu power is only used if the counter is greater or equal to one, where as the other thing makes the computer check for stuff always...

 
n/a

Kramy



Registered
  08/06/2002
Points
  1888
15th May, 2004 at 12:41:29 -

EvisceratoR: It'll check anyways, but it won't execute it, so you save 50% processing.

Counter >= 1
--Subtract 1 from counter

 
Kramy

Tiri



Registered
  16/01/2004
Points
  78
15th May, 2004 at 13:16:03 -

hmm that didnt seem to work...

 
n/a
   

Post Reply



 



Advertisement

Worth A Click