Racing Unlimited v1.5

15 posts

Flag Post

I need some feedback and programming help.
I was trying to figure out how you would create a lap counter. I began working on one and couldn’t get it to work. Any help would be very much appreciated.
NicK

 
Flag Post

you need a variable… and increment the variable every time they make a lap. I don’t get it, is that all?

 
Flag Post

A little bit more detail would be helpful.

Here is the principle of what Indie was talking about in regards to incrementing a variable:

// Create a variable named "laps"
var laps:Number = 0;

// Call this to increment "laps" by 1
laps++;
 
Flag Post

Oh nevermind, I just played your game and saw what it actually was. I think if I were doing it, I would probably set up some markers along the track, maybe 6 total markers on the main points, and the car needs to hit those markers in order for there to be a lap counted (I would make the markers big, also). There’s probably many solutions but there’s one possible way.

 
Flag Post

well, you need to create some checkpoints, so the player can’t just cross the line, come back, cross the line, … i’m a bit lame at code, so well i can think about 2 solutions, by using coordinates of the car or maybe some kind of hittest() with some boxes along the track

 
Flag Post

Well I really just need to know how to get a number to increase by one everytime the player’s car hits the finish line. For now I dont really mind about being able to turn around and go back. I could find a way around that by narrowing the track at the finish line so you can’t easily go back.
NicK

 
Flag Post

I thought of one way to do laps. But am unsure of how to do it myself. If I i put in code so that when car hits finish line then increase lap by one. So far I have a dynamic text box with a var name of laps. And I really don’t know what to do next?
Help!
NicK-

 
Flag Post

Here is some tips:

Assume this is your lap variable:

var numLaps:Number = 0;

This is how to set your text box:

laps.text = "Lap " + numLaps;

This is how I would recommend implementing a lap counter. Make a function, and call it every time they make a lap:

function nextLap():Void {
numLaps++;
laps.text = "Lap " + numLaps;
}

//collision with finish line
nextLap();

 
Flag Post

I am still kind of confused. I am not really good with Actionscript.
NicK
How would I put that code in my text box. I can’t put any code in text boxes? Also I don’t know how to do hittests…

 
Flag Post

I think you need to take a couple steps back and go through some Flash basics tutorials. You’ve got to learn the principles of using Flash before you jump far ahead. Otherwise we’ll have to explain every single step (of every single step) of the process.

 
Flag Post

Where did you learn all of the Flash basics. I have been having trouble finding tutorials that are for what I need.
I just really want a lap counter for my game and have been having a lot of trouble with it.

 
Flag Post

Here is a link to the Kongregate thread on ‘Getting Started’

Games are some of the most complex types of programs you can create in Flash, so you will need to know at least intermediate ActionScripting.

 
Flag Post

As well as the new sticky thread: Flash Resources

Additionally, if you need help with coding you may wish to post in the Programming forum instead. This forum is for discussing games, and the other is for development help.

 
Flag Post

Thanks for all of your help guys. I really appreciate it.
Hopefully you will get to see a completed version of my game soon.

 
Flag Post

hhello