Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by hurik

hello,

i have a strange problem and i don't now if i'm too stupid or it is a bug.

i have this entity (it's a example, not really with a function):
ig.module(
	'game.entities.nowm.scrollarrows'
)
.requires(
	'impact.entity'
)
.defines(function(){

EntityScrollarrows = ig.Entity.extend({
	size: {
		x: 8,
		y: 64
	},

	animSheet: new ig.AnimationSheet('media/scrollarrow.png', 8, 64),

	init: function() {
		this.addAnim('idle', 5, [0]);

		this.currentAnim.pivot = {
			x: 0,
			y: 0
		};
	},

	draw: function() {
		// Left arrow
		this.anims.idle.angle = 0;
		this.currentAnim.draw(this.size.x, -this.size.y / 2);
		this.currentAnim.draw(this.size.x, ig.system.height / 2 - this.size.y / 2);
		this.currentAnim.draw(this.size.x, ig.system.height - this.size.y / 2); // not drawn

		// Up arrow
		this.anims.idle.angle = Math.PI / 2;
		this.currentAnim.draw(this.size.y / 2, this.size.x);
		this.currentAnim.draw(ig.system.width / 2 + this.size.y / 2, this.size.x);
		this.currentAnim.draw(ig.system.width + this.size.y / 2, this.size.x);

		// Right arrow
		this.anims.idle.angle = Math.PI;
		this.currentAnim.draw(ig.system.width - this.size.x, this.size.y / 2);
		this.currentAnim.draw(ig.system.width - this.size.x, ig.system.height / 2 + this.size.y / 2);
		this.currentAnim.draw(ig.system.width - this.size.x, ig.system.height + this.size.y / 2); // not drawn

		// Down arrow
		this.anims.idle.angle = Math.PI * 1.5;
		this.currentAnim.draw(- this.size.y / 2, ig.system.height - this.size.x);
		this.currentAnim.draw(ig.system.width / 2 - this.size.y / 2, ig.system.height - this.size.x);
		this.currentAnim.draw(ig.system.width - this.size.y / 2, ig.system.height - this.size.x);
	}
});

});

and the to draws which i marked are not drawn. when the right up arrow touches the right side it is not drawn anymore ... the same problem with the down right arrow ...

all other a drawn without problems.

here a screenshot:
/><br />
<br />
anyone an idea?<br />
<br />
hurik			</div>
		</div>
			<div class=

1 decade ago by hurik

ok, problem solved.

because of the change in the angle an the pivot, the x, y pos were outside the screen. and the draw only paint when the x, y coordinates are in the screen.

example:
/><br />
<br />
not really a bug but i would vote for a change ...<br />
<br />
to "fix" this comment the line 87 - 93 out in the file lib/impact/animation.js<br />
<br />
hurik			</div>
		</div>
			<div class=

1 decade ago by dominic

That is a bug. The "On screen"-check should take the pivot into account. Sorry, I'll fix it!

1 decade ago by hurik

Quote from dominic
That is a bug. The "On screen"-check should take the pivot into account. Sorry, I'll fix it!

thanks dominic!

it would be nice if you would inform me here, when you have fixed it on the git repo.
Page 1 of 1
« first « previous next › last »