I have two problems that are causing me a headache:
1. How to detect when the player is near an edge in the collision map to move up there?
http://i.imgur.com/yxeBD.png
2. Is there any way to make a fade between frames of animation?
1 decade ago
by emati
I have similar problem too. I do not found any collision type that return check or collideWith function for entity which do not affect other entity (move them or even be moved by other stronger).
I believe you can put some kind of trigger entity in edges and trigger movement you want. Trigger entity is described by dominic in this tutorial:
link and code is here:
link
Oh, i almost missed second question. There is no fade between animation frames available in impact right now.
(Sorry for my English!)
Actually what I need is to check the collisionmap with handleMovementTrace until there is no a tile (to move the player to the edge), but I do not understand how to do it or not I have the right information at ig.game.collisionMap.
Solved! The code is messy and is full of problems, but basically I resolve the conflict.
handleMovementTrace: function(res) {
var mx = this.vel.x * ig.system.tick,
my = this.vel.y * ig.system.tick;
if(res.collision.y) {
var res_x1 = ig.game.collisionMap.trace((this.pos.x + this.size.x) - 20, this.pos.y, mx, my, this.size.x / 4, this.size.y);
var res_x2 = ig.game.collisionMap.trace(this.pos.x, this.pos.y, mx, my, this.size.x / 4, this.size.y);
if(!res_x1.collision.y) res.pos.x += 1;
if(!res_x2.collision.y) res.pos.x -= 2;
}
if(res.collision.x) {
var res_y1 = ig.game.collisionMap.trace(this.pos.x, (this.pos.y + this.size.y) - 20, mx, my, this.size.x, this.size.y / 4);
var res_y2 = ig.game.collisionMap.trace(this.pos.x, this.pos.y, mx, my, this.size.x, this.size.y / 4);
if(!res_y1.collision.x) res.pos.y += 1;
if(!res_y2.collision.x) res.pos.y -= 2;
}
this.parent(res);
}
Page 1 of 1
« first
« previous
next ›
last »