Hi all,
I’m now creating a maze, but the examples I have found only showed me how to do it with keyboard. Wondering should there be a way to use mouse to drag cursor around instead of keyboard? I have tried to apply mouse down drag command, but the cursor just cut right through the wall (of the maze).
The following is the script I have got for the maze;
onClipEvent(enterFrame) {
if(Key.isDown(Key.UP)) {
this._y -= 3;
}
else if(Key.isDown(Key.DOWN)) {
this._y += 3;
}
if(Key.isDown(Key.LEFT)) {
this._x -= 3;
}
else if(Key.isDown(Key.RIGHT)) {
this._x += 3;
}
if(_root.maze.hitTest(_x+(_width/3),_y,true)) {
this._x -= 3;
}
if(_root.maze.hitTest(_x-(_width/3),_y,true)) {
this._x += 3;
}
if(_root.maze.hitTest(_x,_y+(_height/3),true)) {
this._y -= 3;
}
if(_root.maze.hitTest(_x,_y-(_height/3),true)) {
this._y += 3;
}
}
Please help, thanks!