Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Drift Engine Request  (Read 1239 times)

0 Members and 1 Guest are viewing this topic.

Xerxes

Drift Engine Request
« on: March 25, 2007, 08:17:32 am »
I need a walking engine that is really loose so when you hold a certain directional key, then let go the object keeps going. and after letting go of the key if you click another direction key the object drifts
Logged

mit

Re: Drift Engine Request
« Reply #1 on: March 25, 2007, 12:34:38 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
Drifts... as in, a racing game? That depends on a lot.

But for a walking engine, I suppose a simple sort of thing could be achived with motion_add...
Code: [Select]
if keyboard_check(vk_right) motion_add(0,1)
if keyboard_check(vk_up) motion_add(90,1)
if keyboard_check(vk_left) motion_add(180,1)
if keyboard_check(vk_down) motion_add(270,1)

speed=min(speed,10) //You might want to limit it like this, to stop it going crazy.
Dunno if that's what you wanted.
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games

Goodnight

Once and future Captain
Re: Drift Engine Request
« Reply #2 on: March 25, 2007, 08:16:23 pm »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
Sort of like walking on ice? So if you hold a direction then it takes a few seconds to get up to speed, then you gradually slow down when you let go?

mit's code will work except for slowing down; you'll keep moving until you hit another direction.
Logged
Re: Drift Engine Request
« Reply #3 on: March 25, 2007, 10:51:21 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Female
  • Posts: 2374
Add friction=0.5 to the end of Mit's code, and change the 0.5 to whatever fits you.
Logged

Devy

Re: Drift Engine Request
« Reply #4 on: March 26, 2007, 12:17:10 am »
hmm clarify about what you want :P
Logged

Xerxes

Re: Drift Engine Request
« Reply #5 on: March 28, 2007, 08:33:37 am »
Sort of like walking on ice? So if you hold a direction then it takes a few seconds to get up to speed, then you gradually slow down when you let go?

mit's code will work except for slowing down; you'll keep moving until you hit another direction.
yeah but this space. Other than that your post is exactly how I would put it.
The object can't keep going it slow down after a little bit
Logged

mit

Re: Drift Engine Request
« Reply #6 on: March 28, 2007, 08:12:22 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
The simplest thing for a space engine would be to look at the asteroids example that comes with game maker.
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games

Obsequious Eye

King of Glass
Re: Drift Engine Request
« Reply #7 on: March 29, 2007, 12:10:06 am »
  • Yes, I am mocking you
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 298
Sort of like walking on ice? So if you hold a direction then it takes a few seconds to get up to speed, then you gradually slow down when you let go?

mit's code will work except for slowing down; you'll keep moving until you hit another direction.
yeah but this space. Other than that your post is exactly how I would put it.
The object can't keep going it slow down after a little bit
In space it wouldn't slow down, there's no friction to stop it (besides micro-gravity and small particles). So it would work. But I can see your point, as most space games have you slow down after a bit.

mit, I didn't know there was an astroids example that came with Game Maker, that's pretty cool. Is this a more recent addition? (I know I never saw one when I downloaded it).
Logged
I'm watching you...
  • Omniscient Eye
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.03 seconds with 50 queries.

anything