View Full Version : help with boundries
hello I am making a street fighter like game, I have my characters and most of their moves sussed Im still working on the AI talking to people on these boards and others but this question I think is a little simpler.
I need to con fine the movements of everything on the stage to the size of the movie. becase of the wieght of the code in the fighters I was hoping I could put a script off stage that refferes to them and simply states that they can not move passed 600x800.
angelas
07-23-2001, 07:05 PM
If you figure something out will you let me know? My e-mail is: sprana85@mio.uwosh.edu. I can't keep my map from scrolling right off the screen. I tried using if statements to check for the boundaries and only continue if the map was within them, but it's not working. I posted a thread but no one has been helpful yet.
I'll let you know if I figure anything out.
Angela
yer I read your other post for some clues too.
I will tell you what I was considering as solution,
draw the outline of the space I want to contian drop its alpha turn it into a MC and give a an instance name (bounds) then use hit test to stop the motion of my other MC when ever it detects a hit between the bounds MC an my other clips.
I know there must be a simpler way but this way should work in theory so if no one helps thats what Im going to do.
feel free to give it a stab.
JIM
TSP
Angela,
make your bondries as seperate clips and put this in them
onClipEvent (enterFrame) {
if (_root.yourbondries.hitTest(_root.yourMC))
_root.yourMC._x += 10;
}
you will need to add the y axis because I'm assuming your map can be move in bot y x
anyway this works and its quite nice if you place your bundries of the stage/viewable area with no alpha when your map hits it this script will push it back in
O yer make sure that the left bound pushes += the right one pushes -= etc.
[Edited by tsp on 07-24-2001 at 06:46 AM]
defrex
07-25-2001, 01:12 AM
why don't you just use x and y instead?
onClipEvent (enterFrame){
if (_root.yourMC._x == 550){
_root.yourMC._x--
}
}
would that not be cleaner than using hitTest?
I am only using the x plane because my movies only need to travel left to right.
and you say why not use x and y but your script only seem's to deal with the x?
defrex
07-25-2001, 04:47 PM
lol, thats not realy what i was talking about. you said you were using hitTest to see if somthing went off the stage right? i was just saying why don't you do it that way instead?
sorry I got the wrong end of the stick.
any way I've got my problem sorted with my hittest method, I like the way the MC's dont just stop at the edge but slide back in(looks nice).
as for helping angela your way may be the best option?
if I ever get my game finished I will post it and you can tell me what ya think.
over and out
Jim TSP.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.