Top-down car game

6 posts

Flag Post

So I have one working AS2 file, which I have tried to convert into a AS3 file. Do you have any ideas why the car behaves so weird in the as3 file?

This is the working AS2 file;

This is the Not Working AS3 file;

The comments and some of the code is in Norwegian, please let me know if I should translate it to english.

Any Ideas what I have to do to make the as3 file work?

Best regards Simon

Flag Post

You’re making it very hard to help – I don’t want to download your code.

Why don’t you use pastebin?

Flag Post

I dont know how to post the codes here, but I have asked for hlp in another forum aswell, the codes can be found here:

Flag Post

Perhaps you could describe the unwanted behaviour? Or post the misbehaving compiled swf on fastswf.

Flag Post

Without more details, all we can do is glance at your code and throw out guesses. Is it keyboard input issues? Be aware that, in order to emulate AS2-style keyboard input mechanics, you have to either recreate the functionality in AS3 or find a library.

Flag Post

Your version in as3 misses action for pressing UP key button and do 2 actions for pressing RIGHT key button. Fix the first one back to UP key. Also, the piece of code below shall be in another function(name given below), not in the code end, where it compiles once only. This will get the car moving, but theres still something wrong with rotation/turning. The way to detect key pressed is rather weird, try redoing it in another way.

fartx = Math.sin(rotation*(Math.PI/180))fart;
farty = Math.cos(rotation
// Setter bilens x og y verdier lik den gjeldende verdien + farten i både x og y aksene.
bil.x += fartx;
bil.y += farty;
//Setter skyggen til bilen lik bilens posisjon, men hele tiden er skyggen 8 piksler til venstre for bilen, og 4 piksler over bilen.
skygge.x = bil.x – 4;
skygge.y = bil.y + 2;
// Setter skyggen til å ha samme vinkel som bilen. Hvis bilen står skrått står skyggen også skrått.
skygge.rotation = bil.rotation;


function kjørBil(event:Event)