Jump to content


Photo

Go-kart Racing Game


  • Please log in to reply
12 replies to this topic

#1 iceflame1019

iceflame1019

    GMC Member

  • New Member
  • 846 posts

Posted 08 September 2007 - 04:24 PM

Perio Kart...A racing sequel to my Uber Perio game in construction, however I'm having some coding issues.  I haven't really used GM in a while so it's probably something I'm overlooking or forgetting.
Here's the .gm6 downoad link:
http://upload2.net/p..._trial.gm6.html

1) SOLVED: how do I keep the karts stationary?  I have it set up as such: [EDIT: updated codes]
Right Key--Accelerate, Keyboard event
if hspeed<20
  hspeed+=.5
Left Key--Brake, Keyboard event
if hspeed>0
  hspeed-=1
else if hspeed=0
  speed=0
No Key--slow down, Keyboard event
if hspeed>0
    speed-=.5

this was solved by using this in the no key code:
if hspeed>0
speed-=.5

if self.hspeed<0{hspeed=0}

2) How would I make it so that a track (room) can be looped?  This is a side-scrolling track but I want to give the impression of being cirular, so I want the cars to, once they've crossed the finish line, jump back to the start and continue.  (this'd make it easier to drop mines and bombs and stuff, a request from my friends)

Also where can I find a good tutorial on having the karts follow slopes/slowdown-speed up on slopes/rotate when going up-down slopes/shoot off a slope when going fast?  for the life of me I cannot find a tutorial (would help if my browser would load some of the pages  :P )

I will most likely have more problems later on so I'll just edit this thread when issues arise.  If it gets really underway I might ask it to be moved to WIP, I don't know.  Right now I've just finished the main racing sprites so it's not fully underway.

EDIT: okay new problem (other than that i hate the three-day bumping limit):

I've tried to implement rotation for when the kart falls to a lower level of the track, but no matter what I do, the cart always flips vertically and gets stuck in the ground.  All I'm doing is in the step event:
if vspeed>0
  image_rotate=direction
that's all for now cuz all I'm doing is driving it over a small ledge to the track below.  Where can I find a tutorial for slopes/rotations and stuff?

Edited by iceflame1019, 22 September 2007 - 05:52 PM.

  • 0

#2 crems123

crems123

    GMC Member

  • New Member
  • 90 posts

Posted 08 September 2007 - 05:02 PM

when you say

speed-=0.6

then if the number is not a multiple of 0.6 then it will skip 0.

eg.

if the speed was 2 it would go:

2,1.4,0.8,0.2,-0.4

as you can see it never = 0

so instead of if ....=0 put if......<0




2) you need to use timelines or just overlap the left and right of the room and when the car gets to the end change the objects x value to the start of the room.

Edited by crems123, 08 September 2007 - 05:05 PM.

  • 0

#3 valkyriezero

valkyriezero

    GMC Member

  • New Member
  • 51 posts

Posted 08 September 2007 - 07:07 PM

i thought you could just use friction, but there must be some reason you must not being using it, im probably newer then you are.....
  • 0

#4 iceflame1019

iceflame1019

    GMC Member

  • New Member
  • 846 posts

Posted 08 September 2007 - 09:40 PM

when you say

speed-=0.6

then if the number is not a multiple of 0.6 then it will skip 0.

eg.

if the speed was 2 it would go:

2,1.4,0.8,0.2,-0.4

as you can see it never = 0

so instead of      if ....=0 put if......<0


well I changed it so the things are all multiples of .5...before I posted, it would do the same thing even with multiples. Must've been a glitch...oh well, it's fixed now. thanks anyway.

@valkyriezero
I was thinking of using friction, but as I don't understand much about how it works yet I'm not using it. If that glitch with acceleration comes up again, though, I'll try friction.
  • 0

#5 valkyriezero

valkyriezero

    GMC Member

  • New Member
  • 51 posts

Posted 10 September 2007 - 03:31 AM

from what i can tell, it simply subtracts from the speed until it is zero. you even use it in platformer games and everything, just to tell your character to stop instead of making him stop in every line of code. its pretty simple, from the looks of it. im having a similiar problem myself...
  • 0

#6 iceflame1019

iceflame1019

    GMC Member

  • New Member
  • 846 posts

Posted 10 September 2007 - 04:20 AM

well I tried friction...to get him to slow down correctly, he speeds up too slowly, and sometimes gets stuck because there's too much friction to overcome...there's going to be three other racers, and I'm planning on having two different race styles: side-view, where they all have the same stats (basically a blasting course with the planned weapons), and a top-down course where they have different stats like in Mario Kart. Right now I'm just getting the simple side-view ones out of the way so I can get used to GM again.

The acceleration problem is fixed now, but I still can't get the slopes stuff to work. I've just eradicated all the slopes stuff from the game, and I'm starting that over. where can I find a good tutorial/example of slopes, and how can I get the karts to rotate when going up/down slopes?
  • 0

#7 iceflame1019

iceflame1019

    GMC Member

  • New Member
  • 846 posts

Posted 14 September 2007 - 02:49 PM

can anyone help me with this? right now all I need to know is how to code slopes and how to make the kart rotate based on its current direction (IE if it's going uphill it rotates up, downhill it goes down)

anyone? codes, examples or tutorials, anything that can get me going would help.

Edited by iceflame1019, 14 September 2007 - 02:51 PM.

  • 0

#8 iceflame1019

iceflame1019

    GMC Member

  • New Member
  • 846 posts

Posted 17 September 2007 - 02:31 PM

oh come on! surely someone out there can help with this?!? Examples, tutorials, code scraps, anything! All I need is how to implement slopes and then how to make the kart rotate according to the slope! I've been trying by myself and I absolutely cannot get anywhere!

if it's an issue, of course people who help will be in the credits.
  • 0

#9 iceflame1019

iceflame1019

    GMC Member

  • New Member
  • 846 posts

Posted 21 September 2007 - 04:39 PM

anyone? please? I'm seriously stuck on this!
  • 0

#10 Twigster_TF

Twigster_TF

    GMC Member

  • New Member
  • 62 posts

Posted 21 September 2007 - 05:18 PM

will this help?
ok, im not registered, so i cant test it, but i think i know a few ways to solve it.

1: the un-registered way:

have about 24 different subimages in the sprites for each car with various stages of rotation. then, change it to:

(sorry its in drag+drop)

change sprite:

sprite = car
subimg = direction/15
speed = 0

//thats in the drag and drop, so its the animation speed, not car speed



2: the draw_sprite way:

instead of having a sprite for the car object, give it the mask, but leave the sprite empty. instead, use coding in the DRAW EVENT to draw the sprite at the location of the car with the right rotation:

draw_sprite_ext(car,0,x,y,1,1,direction,c_white,1)

(this wil draw it where the car is, (depending on th origins of your sprites).)
(you may need to adjust the x and y to (x+n) and (y+n) to get it correctly positioned (where n is an unknown amount), and maybe change direction to +/-90, (as im not sure how it draws it as it because im unregistered).
  • 0

#11 iceflame1019

iceflame1019

    GMC Member

  • New Member
  • 846 posts

Posted 21 September 2007 - 05:40 PM

I can't test it now cuz i'm at work on a computer that won't run any GM, but I'll test it when I get home! ^_^

In case it doesn't work, though, does anyone have any other ideas? I really wanna get the slopes and stuff out of the way, the actual programming and movement. The slopes, I think, will be set up as 32w by 16h, about half the slope of a perfectly diagonal line.

EDIT: should I have this moved to advanced?

EDIT2: I tried the code, Twigster. It works, but I don't have any slopes yet. When he falls and hits the ground though, the sprite flips back and forth until it is flat on the ground. I added a link to the gm6 file.

Edited by iceflame1019, 22 September 2007 - 06:11 PM.

  • 0

#12 jakeyboy01

jakeyboy01

    GMC Member

  • New Member
  • 226 posts

Posted 21 December 2007 - 01:59 PM

very few people can help you because 2d racers are ba-horing. try making it 3d and then you might get somewhere.
  • 0

#13 iceflame1019

iceflame1019

    GMC Member

  • New Member
  • 846 posts

Posted 27 December 2007 - 04:25 PM

very few people can help you because 2d racers are ba-horing. try making it 3d and then you might get somewhere.

<{POST_SNAPBACK}>


i shall pretend I did not hear that. Yous gots no idea what I plan for this.

and I can't do 3d yet, I'm NOWHERE close to 3d. You want 3D, gimme an engine I can work off of.

Edited by iceflame1019, 27 December 2007 - 04:26 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users