The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.36 / 5.00 33,851 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 12,195 ViewsEvery time i move my character against the top left and bottom left corners he somehow slides through, everywhere else is perfectly sealed off, just those corners
The script itself is here:
onClipEvent(enterFrame){
if(Key.isDown(Key.UP)){
this._y -= 4;
}else if(Key.isDown(Key.DOWN)){
this._y += 4;
}
if(Key.isDown(Key.LEFT)){
this._x -= 4;
}else if(Key.isDown(Key.RIGHT)){
this._x += 4;
}
if(_root.maze.hitTest(_x+(_width/0.73),_y,true)){
this._x -= 4;
}
if(_root.maze.hitTest(_x-(_width/-2),_y,true)){
this._x += 4;
}
if(_root.maze.hitTest(_x,_y+(_height/1.5),true)){
this._y -= 4;
}
if(_root.maze.hitTest(_x,_y-(_height/5),true)){
this._y += 4;
}
}
The walls are 6 pixels wide and theres a 12 pixel gap between each wall (not that that makes a difference right?)
Try using while statements to move the character until he is not colliding anymore.
At 6/2/10 05:53 PM, SmartNoob wrote: Try using while statements to move the character until he is not colliding anymore.
I'm not familiar with "while" statements, how would i go about placing these in the code?
Can you post a .fla so I can see the problem? You gave a terrible description..
:'(
At 6/2/10 06:02 PM, Treerung wrote: Can you post a .fla so I can see the problem? You gave a terrible description..
Mmk, bear in mind i started it about two hours ago so the design isn't great but here you go
At 6/2/10 06:00 PM, Bluehare wrote:At 6/2/10 05:53 PM, SmartNoob wrote: Try using while statements to move the character until he is not colliding anymore.I'm not familiar with "while" statements, how would i go about placing these in the code?
If you don't even know what a while statement is, then I would highly suggest learning the basics of ActionScript.