Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
adding oncharaleave
Browse files Browse the repository at this point in the history
  • Loading branch information
ericoporto committed Nov 13, 2016
1 parent 90d197e commit 29b2bdc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,14 @@ function char(chara, x, y) {
if (this.checkMapBoundaries(px, py, this.mapwidth, this.mapheight) &&
engine.currentLevel["Level"]["collision"][fpos[0]][fpos[1]] == 0) {
this.steps = 32

if ((this.mapx%32==0) && (this.mapy%32==0)) {
var cpx = Math.floor(this.mapx / 32),
cpy = Math.floor(this.mapy / 32) + 1;
//evType [onclick, ontouch, charatouch, charaleave], so we are checking charaleave here!
if (eventInMap(engine.currentLevel["Level"], [0, 0, 0, 1], [cpy, cpx])) {
}
}
} else {
this.waits = 16
}
Expand All @@ -825,7 +833,9 @@ function char(chara, x, y) {
}

} else if (this.steps > 0 && this.waits == 0 && this.stopped == false) {
//this is needed to that the chara walks!
engine.charWalkSteps(this, engine.step)

if ((this.mapx%32==0) && (this.mapy%32==0)) {
var px = Math.floor(this.mapx / 32),
py = Math.floor(this.mapy / 32) + 1;
Expand Down

0 comments on commit 29b2bdc

Please sign in to comment.