Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

interactivity using keys

Status
Not open for further replies.

ron997

Vendor
Joined
Dec 16, 2007
Messages
2
Location
GB
Hi

I am trying to get a object to move using the keys in flash 8. I am trying to get the objects code in the time line.
This is the code im using

plane.onEnterFrame=function(){
if (Key.isDown(Key.RIGHT)){
plane._rotation +=2
}
}
if (Key.isDown(Key.LEFT)){
plane._rotation -=2

}
if (Key.isDown(Key.UP)){
plane._rotation +=2
}

if (Key.isDown(Key.DOWN)){
plane._rotation -=2
}



plane._y+= Math.cos(plane._rotation*Math.PI/180)*-2

plane._x+= Math.sin(plane._rotation*Math.PI/180)*2


I really appericate all the help

thank you

ron997
 
Code:
plane.onEnterFrame = function() {
	if (Key.isDown(Key.RIGHT)) {
		this._rotation += 2;
	} else if (Key.isDown(Key.LEFT)) {
		this._rotation -= 2;
	} else if (Key.isDown(Key.UP)) {
		this._rotation += 2;
	} else if (Key.isDown(Key.DOWN)) {
		this._rotation -= 2;
	}
	this._y += Math.cos(this._rotation*Math.PI/180)*-2;
	this._x += Math.sin(this._rotation*Math.PI/180)*2;
};

Kenneth Kawamoto
 
Thank you i really appericate it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top