The Daily Click ::. Forums ::. Klik Coding Help ::. Eight directional movement
 

Post Reply  Post Oekaki 
 

Posted By Message

Dave S.



Registered
  26/09/2003
Points
  924
16th February, 2004 at 16:30:58 -

I'm messing around with a few ideas (using the built in eight directional movement)but need to know if there is a quick way to trick the computer into thinking that once a directional key is pressed (even for an instant) it could carry out the same computations as if continually holding down that key?

It works perfectly if any of the arrow keys are held down manually for the time it takes for everything (all the block objects) to butt up to themselves or the wall surround (a nanosecond).

Of course eight directional movements wouldn't normally be a problem but I have so many collisions taking place that a press/release of a key can caulse stuttering and bad object collision detections.

Thanks, Dave S.

 
n/a

The Chris Street

Administrator
Unspeakably Lazy Admin

Registered
  14/05/2002
Points
  48488

Game of the Week WinnerClickzine StaffAcoders MemberKlikCast StarVIP MemberPicture Me This Round 35 Winner!Second GOTW AwardYou've Been Circy'd!Picture Me This Round 38 Winner!GOTM December Third Place!!
I am an April FoolKliktober Special Award Tag
16th February, 2004 at 16:46:42 -

Are you talking about a movement like Pacman?

 
n/a

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
16th February, 2004 at 16:48:52 -

set the deceleration to 0.

 
n/a

Dave S.



Registered
  26/09/2003
Points
  924
17th February, 2004 at 02:03:10 -

Circy... yes, similar to 'PacMan' but more like 'Humpty dumpty meets the Fuzzy Wuzzies' (for ZX Spectrum) where everthing slides to one side unless theres an obstacle in the way.

Snerlin, the deceleration is already set to zero. I thought I could use a piece of code to instruct the computer to do all the necessary computations when holding down a directional key without physically holding the key down (press and release) until everthing comes to rest.

Thanks, Dave S.

 
n/a

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
17th February, 2004 at 04:34:07 -

You could set a flag to on whenever the relevant key is pressed, and set it to off again when movement is stopped in that direction. I'm not entirely sure what you want to do, though, having never played that game.

 
http://www.davidn.co.nr - Games, music, living in America

Kramy



Registered
  08/06/2002
Points
  1888
17th February, 2004 at 12:31:08 -

Don't use flags, then you'd need to set 4 or 8. Use an Alterable value. Set it to 0 for stopped, 1 for right, 2 for up-right, 3 for up, etc.

If it collides have it set the alterable value to 0.

If alt-Value equals 2
set pos to Xpixels+1
set pos to ypixels-1

etc.

 
Kramy

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
17th February, 2004 at 12:37:32 -

Ah, that's a better idea.

 
http://www.davidn.co.nr - Games, music, living in America

Dave S.



Registered
  26/09/2003
Points
  924
17th February, 2004 at 13:42:09 -

Kramy, thanks mate, I'll give it a go.

Dave S.

 
n/a

Dave S.



Registered
  26/09/2003
Points
  924
17th February, 2004 at 13:42:55 -

Kramy, thanks mate, I'll give it a go.

Dave S.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click