Here is just a base of what iv made, any suggestions are welcome.
Also if you know how to make the rotation correct by where the mouse is it would be appriciated.
i havnt done any gfx for it yet as i suck at gfx.
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.rocketfired = 0;
onTimeout();
}
function onWeaponfired() {
if (this.rocketfired == "1") {
this.rx = mousex;
this.ry = mousey;
onTimeout();
}
this.rocketfired = 1;
}
function onTimeout() {
if (this.rx < mousex) {
this.rx++;
}
if (this.ry < mousey) {
this.ry++;
}
if (this.rx > mousex) {
this.rx--;
}
if (this.ry > mousey) {
this.ry--;
}
if (this.rocketfired == "1") {
showimg(1, "block.png", this.rx, this.ry);
player.chat = "Rocket Moving!";
}
if (onwall(this.rx, this.ry)) {
onExplodeRocket();
}
for (temp.pl: players) {
if (this.rx in | pl.x, pl.x + 2.5 | && this.ry in | pl.y, pl.y + 3 | ) {
onExplodeRocket();
}
}
settimer(0.05);
}
function onExplodeRocket() {
if (this.rocketfired == "1") {
putexplosion(1, this.rx, this.ry);
player.chat = "Rocket Exploded!";
this.rocketfired = 0;
hideimg(1);
}
}