Needing Help With Actoinscript Programming..


NoidZ

Mind the world, need for panic
Joined
Apr 2, 2006
Messages
757
Age
33
Location
The Netherlands
Website
Visit site
Hi,

Yet another thing which I'll probably like for just a few days but here's my question :lol: I'm just learing about actionscripting for games in Flash 8. This is what I what I've got:

function onEnterFrame() {
//buttonpressing
if (Key.isDown(Key.RIGHT)) {
player._x += 15;
}
if (Key.isDown(Key.LEFT)) {
player._x -= 15;
}

}

I'm creating a breakout game (just as startoff ofcourse) but what the hell am I supposed to do to stop the player when it has reached a certain point?

Thanks!!
 

DialTone

Still Fresh
Joined
Mar 8, 2006
Messages
38
Age
49
Website
Visit site
function onEnterFrame() {
//buttonpressing
if ((Key.isDown(Key.RIGHT)) && (player._x <=700)) {
player._x += 15;
}
if ((Key.isDown(Key.LEFT)) && (player._x >= 30)) {
player._x -= 15;
}

}


This would limit the player "X" position to a range from 30 to 700 inclusive

Tony
 
Top