TunerzWST
03-12-2005, 02:56 AM
I am making a birds eye view 2 player fighting game. Here is where I am so far.
Plug Fight (http://img205.exs.cx/my.php?loc=img205&image=pluggame1ma.swf)
Script for P1:
onClipEvent(load)
{
speed =0 ;
}
onClipEvent (enterFrame) {
// make the car go forward
if (Key.isDown(Key.UP)) {
speed += 1;
}
// make the car go backwards
if (Key.isDown(Key.DOWN)) {
speed -= 1;
}
// tells the car to slow down after the speed of 20
if (Math.abs(speed)>20) {
speed *= .7;
}
// you can change the rotation of the car to your desire
if (Key.isDown(Key.LEFT)) {
_rotation -= 15;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 15;
}
// here is where the hittest is for the boundary
speed *= .98;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.land.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -.0;
}
}
P2:
onClipEvent (load) {
speed = 0;
}
onClipEvent (enterFrame) {
// make the car go forward
if (Key.isDown(87)) {
speed += 1;
}
// make the car go backwards
if (Key.isDown(83)) {
speed -= 1;
}
// tells the car to slow down after the speed of 20
if (Math.abs(speed)>20) {
speed *= .7;
}
// you can change the rotation of the car to your desire
if (Key.isDown(65)) {
_rotation -= 15;
}
if (Key.isDown(68)) {
_rotation += 15;
}
// here is where the hittest is for the boundary
speed *= .98;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.land2.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
}
}
How do I allow them to shoot each other and cause damage?
Plug Fight (http://img205.exs.cx/my.php?loc=img205&image=pluggame1ma.swf)
Script for P1:
onClipEvent(load)
{
speed =0 ;
}
onClipEvent (enterFrame) {
// make the car go forward
if (Key.isDown(Key.UP)) {
speed += 1;
}
// make the car go backwards
if (Key.isDown(Key.DOWN)) {
speed -= 1;
}
// tells the car to slow down after the speed of 20
if (Math.abs(speed)>20) {
speed *= .7;
}
// you can change the rotation of the car to your desire
if (Key.isDown(Key.LEFT)) {
_rotation -= 15;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 15;
}
// here is where the hittest is for the boundary
speed *= .98;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.land.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -.0;
}
}
P2:
onClipEvent (load) {
speed = 0;
}
onClipEvent (enterFrame) {
// make the car go forward
if (Key.isDown(87)) {
speed += 1;
}
// make the car go backwards
if (Key.isDown(83)) {
speed -= 1;
}
// tells the car to slow down after the speed of 20
if (Math.abs(speed)>20) {
speed *= .7;
}
// you can change the rotation of the car to your desire
if (Key.isDown(65)) {
_rotation -= 15;
}
if (Key.isDown(68)) {
_rotation += 15;
}
// here is where the hittest is for the boundary
speed *= .98;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.land2.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
}
}
How do I allow them to shoot each other and cause damage?