What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »
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
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:
[http://www.dreamincode.net/forums/topic/312403-top-down-racing-game/page\_\_gopid\_\_1803907&#entry1803907](http://www.dreamincode.net/forums/topic/312403-top-down-racing-game/page __gopid__ 1803907&#entry1803907)
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.
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(Math.PI/180))fart-1;
// 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;