View Full Version : Boundary
Sickcivic98
08-12-2005, 02:50 AM
I am trying to make a game but in order to make this game successful I need to know how to deal with boundaries. I have a box on the top of the stage and a box on the bottom of the stage. I have an object that I can control going up and down and such. But I want that object to not go through those boxes. Does anyone know what the best way would be to do this. I've tried many ways and have come close but it wasn't good enough. So if anyone can help, that would be great! :)
billystyx
08-12-2005, 09:39 AM
what have you tried? (Post some code). There is a couple of ways of testing hits with a boundary, hitTest, centre x,y tests, or border tests (greater than 400, less than 0).
Show us what you have and tell us what went wrong.
billystyx
Sickcivic98
08-13-2005, 01:48 AM
Just to let everyone know I have figured it out. I have a code that does in fact work. The code is to be put on the movie clip that you don't want to go through the object. This is the code.
onClipEvent (enterFrame) {
if (hitTest(_level0.instancename)==true)
_y=_y+7;
}
The instance name is a block that is on the top of my stage. The _y=_y+7; works in my case but for others I'm sure it will change. The object that I put that code on will not go through that block anymore. :)
vBulletin v3.5, Copyright ©2000-2010, Jelsoft Enterprises Ltd.