ich habe mir vorgenommen ein Spiel ähnlich wie Warsheep von ICQ zu programmieren, wenn dies den Flashexperten aus diesem Forum kein Begriff sein sollte, werde ich es erklären.
Ich steuer mein Fahrzeug mit
- Code: Alles auswählen
onClipEvent (load) {
var speed_tank = 15;
var rot_speed_tank = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._rotation -= rot_speed_tank;
} else if (Key.isDown(Key.RIGHT)) {
this._rotation += rot_speed_tank;
}
if (Key.isDown(Key.UP)) {
var sobj = getSpeed(this._rotation);
this._x += sobj.spdx;
this._y += sobj.spdy;
} else if (Key.isDown(Key.DOWN)) {
var sobj = getSpeed(this._rotation);
this._x -= sobj.spdx;
this._y -= sobj.spdy;
}
function getSpeed(ang) {
ang = ang*Math.PI/180;
var sx = Math.sin(ang)*speed_tank;
var sy = -Math.cos(ang)*speed_tank;
return {spdx:sx, spdy:sy};
}
}
Ich weiß aber nicht, wie ich das machen soll, dass sie im Gelände nicht über Hindernisse fahren können.
Mit welchem Code oder welchen Formeln und Funktionen kann ich soetwas bewerkstelligen?
