Need help please.

8 posts

Flag Post

So I am trying to create a game but I need a way to make the character go different speeds at different angles. For example if he were pointing down he would go faster than pointing up. Does anyone know a tutorial that teaches this? Thanks.

 
Flag Post

What are you using to make this game?

 
Flag Post

Sorry, as2.

 
Flag Post

More details, please? That seems pretty simple to do, however your description can be interpreted in many different ways and I don’t know what do you want to do.

 
Flag Post

Ok, in games such as launch the turtle and flight, the character go slower when flying upwards and speeds up when flying downwards. I am new to programming so I have no clue how to do this and can find no information on how.

 
Flag Post

Do you mean something like this (very rudimentary example):

 
var ySpeed:Number;
var xSpeed:Number;

function onEnterFrame () {

_y += ySpeed;
_x += xSpeed;

if (ySpeed > 0) {
ySpeed++
xSpeed++
}
else {
xSpeed--
}
ySpeed++
}

(I don’t know much about as2 so the code itself might have mistakes, but I hope you understand)

 
Flag Post

Sounds like you are trying to implement simple physics: velocity, acceleration and gravity. Basically, you want the character’s direction to represent their acceleration, and for gravitational acceleration to be active. If you don’t have a decent grasp of physics, I would just recommend learning AS3 and using an AS3 physics engine to do all that dirty work for you (something like Flixel) since it is much better in the long run. Unfortunately I’m not familiar with AS2 so I can’t find a good velocity-AS2 tutorial.

 
Flag Post

The easiest way to simulate physics based motion, without getting too complicated is to go something like:

var xVel:Number;
var yVel:Number;
var xAcc:Number;
var yAcc:Number;
onEnterFrame{
   _x+=xVel;
   _y+=yVel;
   xVel+=xAcc;
   yVel+=yAcc;
}