1 decade ago by drhayes
This might be hard to explain and requires some screenshots. I'll do my best.
Weltmeister isn't drawing one of my entities correctly. I suspect it is because of the custom draw code.
I have an entity representing a gun with a barrel that can aim. I'm achieving this by defining the entity like this:
The important bit is the draw function. Notice how it calls the parent to draw the base and then draws the shoot animation on top of it, offset a bit.
This works great in the game itself.
In Weltmeister, once I move the map by right-click dragging, I start to see problems. Here's a screenshot of Weltmeister after I've right-click dragged down and to the right.
Weltmeister isn't drawing one of my entities correctly. I suspect it is because of the custom draw code.
I have an entity representing a gun with a barrel that can aim. I'm achieving this by defining the entity like this:
EntityGun = ig.Entity.extend({
animSheet: new ig.AnimationSheet('media/gun.png', 16, 16),
size: {x: 16, y: 16},
barrelAngle: 0,
init: function(x, y, settings) {
this.parent(x, y, settings);
this.addAnim('base', 1, [0], true);
this.addAnim('shoot', 0.05, [1, 2, 2, 3, 3, 3, 2, 2, 2, 1], true);
this.anims.shoot.pivot = {x:2, y: 5};
this.anims.shoot.frame = 9;
this.currentAnim = this.anims.base;
},
setBarrelAngle: function(angle) {
this.anims.shoot.angle = angle;
},
draw: function() {
this.parent();
this.anims.shoot.draw(this.pos.x + 6, this.pos.y - 3);
},
update: function() {
}
});
The important bit is the draw function. Notice how it calls the parent to draw the base and then draws the shoot animation on top of it, offset a bit.
This works great in the game itself.
In Weltmeister, once I move the map by right-click dragging, I start to see problems. Here's a screenshot of Weltmeister after I've right-click dragged down and to the right.
