1 decade ago by Jastro
Hi guys i am trying to create a parabolic arrow (you know like the skeleton archers from minecraft, here a Pic with a example: http://www.splung.com/kinematics/images/projectiles/parabola.png). But i dont know how can i do it i creating a strange things.
EntityArrow = ig.Entity.extend({
// Set some of the properties
collides: ig.Entity.COLLIDES.ACTIVE,
type: ig.Entity.TYPE.A,
checkAgainst: ig.Entity.TYPE.B,
speed:200,
size: {x: 12, y: 16},
// Load an animation sheet
animSheet: new ig.AnimationSheet( 'media/arrow.png', 12, 16 ),
init: function( x, y, settings ) {
this.parent( x, y, settings );
this.addAnim( 'idle', 0.1, [0] );
}
update: function() {
T_x = this.pos.x // the X distance to travel
T_y = this.pos.y // the Y distance to travel
s_x = speed * cos(angle) // the X speed
s_y = speed * sin(angle) // the Y speed
this.parent();
}
});#
I saw some formulas but really dont understand how can i apply to the impactjs code. Somebody can help me please? thanks you in advance
code
EntityArrow = ig.Entity.extend({
// Set some of the properties
collides: ig.Entity.COLLIDES.ACTIVE,
type: ig.Entity.TYPE.A,
checkAgainst: ig.Entity.TYPE.B,
speed:200,
size: {x: 12, y: 16},
// Load an animation sheet
animSheet: new ig.AnimationSheet( 'media/arrow.png', 12, 16 ),
init: function( x, y, settings ) {
this.parent( x, y, settings );
this.addAnim( 'idle', 0.1, [0] );
}
update: function() {
T_x = this.pos.x // the X distance to travel
T_y = this.pos.y // the Y distance to travel
s_x = speed * cos(angle) // the X speed
s_y = speed * sin(angle) // the Y speed
this.parent();
}
});#
I saw some formulas but really dont understand how can i apply to the impactjs code. Somebody can help me please? thanks you in advance