Need help with a Flash car game

  • Jason1065
  • Born
  • Born
  • No Avatar
  • Joined: Apr 26, 2011
  • Posts: 3
  • Status: Offline

Post April 26th, 2011, 12:40 pm

ok i have been working on a flash game and its a top view game. So i have my player and a car but when there is one car he goes in a it works hold a to get out. But if I add a second car when i go in one they both move the exact same. Im still pretty basic at actionscript so can u give me a way to add more cars with them working. Arrow keys to move and walk up to a car to go in and hold a and move to get out.
File Link:2sharedadd dotcome here/file/N2K9jVmY/Car_Test.html
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 26th, 2011, 12:40 pm

  • DEVNEB
  • Newbie
  • Newbie
  • User avatar
  • Joined: Jun 26, 2011
  • Posts: 9
  • Loc: Quebec
  • Status: Offline

Post June 26th, 2011, 11:00 pm

Ok, well... First, I don't want to be rude, but there's a big lack of understanding in your code... Anyway, surely it will be better to write this game with AS3 or with AS2 proper object programming.

The fact is the way you coded the thing, all the cars are listening to the same events and you're only checking if the person is invisible to make them "moving" :

Code: [ Select ]
if (Key.isDown(Key.SPACE)&& _root.person._visible==false) {
speed += 1;
}
  1. if (Key.isDown(Key.SPACE)&& _root.person._visible==false) {
  2. speed += 1;
  3. }
  • Jason1065
  • Born
  • Born
  • No Avatar
  • Joined: Apr 26, 2011
  • Posts: 3
  • Status: Offline

Post June 27th, 2011, 8:59 am

Ok so i got all that but see im not the one who wrote the code my friend did so now is there a way i can fix it or is the code u put there the way to fix it
  • DEVNEB
  • Newbie
  • Newbie
  • User avatar
  • Joined: Jun 26, 2011
  • Posts: 9
  • Loc: Quebec
  • Status: Offline

Post June 27th, 2011, 10:07 am

Nope, I only give you some advice where the matter reside in your friend's code.

Personnally, I would clean up and organize the code before doing anything...
But I cannot do it for you, since it could take a moment.

Following the way everything was coded, you could create a var in the root (like _root.currentCar) and test if :
Code: [ Select ]
_root.currentCar == this


In remplacement of :
Code: [ Select ]
_root.person._visible==false


Then, when the person enter a specific car, you set this root var like :
Code: [ Select ]
_root.currentCar = _root.car // or the hit object


But at this point, I'm not so sure what you really want the game to be. Also, this code is some old school AS2... Writing onClipEvent directly on the object on the stage is very awkward. I understand it was done a few time ago or using old source code. But time is changing and it could be really useful to learn and code in some right way (I mean, actual)... otherwise, it could result in so much headache of attempts/errors.
  • Jason1065
  • Born
  • Born
  • No Avatar
  • Joined: Apr 26, 2011
  • Posts: 3
  • Status: Offline

Post June 27th, 2011, 11:34 am

Ok thanks a ton this will really help out and the game im making is like your a stick figure and youll be in a town almost like an rpg an u canget jobs and increase stats and stuff almost like real life this was used so if u found a car on the side of the road u could like hotwire it and get in so ya thanks a ton

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 36 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.