ForumsProgramming ForumWhat's wrong?

3 3278
LLeRRoux
offline
LLeRRoux
70 posts
Nomad

Ok, so i'm working on a tile-based game, and now my code isn't working correctly.

onEnterFrame = function(){
if(this.hitTest(_root.char)){
if(_root.char._y >= this._y){
if(_root.char._x = this._x-10){
_root.canright = false;
}
}
}
if(this.hitTest(_root.char)){
if(_root.char._y >= this._y){
if(_root.char._x = this._x+40){
_root.canleft = false;
}
}
}
if(_root.char._x < this._x-10){
_root.canright = true;
}
if(_root.char._x > this._x+40){
_root.canleft = true;
}
}


This is in my block tile's actions. So when I test the movie, the left wall blocks me, but if I hit a right wall, I just pass through it at double speed. Does anyone know what's whong with my code?

  • 3 Replies
LLeRRoux
offline
LLeRRoux
70 posts
Nomad

Oh, and before the code for left wall was added, right walls worked perfectly well.

LLeRRoux
offline
LLeRRoux
70 posts
Nomad

Ok, I'll try that tomorrow.

Showing 1-2 of 3