Oh wow, there are q few issues with it.
Bullet needs a speed member:
function Bullet(name, start_x, start_y, vel_x, vel_y)
{
this.name = name;
this.xVelocity = vel_x;
this.yVelocity = vel_y;
this.speed = 1;
CreatePerson(name, "bullet.rss", true); // name of this bullet;
SetPersonX(name, start_x);
SetPersonY(name, start_y);
IgnoreTileObstructions(name);
}
And you are right about x and y, I wanted to have local variables:
Bullet.prototype.update = function() {
var x = GetPersonX(this.name) + this.xVelocity * this.speed;
var y = GetPersonY(this.name) + this.yVelocity * this.speed;
SetPersonX(this.name, x);
SetPersonY(this.name, y);
if (IsPersonObstructedAt(x, y)) {
this.dead = true;
var name = GetObstructingPerson(this.name, GetPersonX(this.name), GetPersonY(this.name));
if (name != "") {
// here we have an obstructing entity..
}
}
}
I'll update the source as well, yikes!