Who said fallin off of a horse couldn't be an inspiration
Posts
138
hi i need to know if my code only needs minor tweaking or if i should scrap it and completely over haul it. i want the tank to slow to a stop, and for the rumble to stop or at least lower in volume when the movement key is released. i cant get the wall collision straight
keys are:
player 1
up arrow move forward
down arrow move back
left&right arrow rotate tank
V & B rotate turret
player 2
move forward 8
move back 5
rotate tank 4&6
rotate turret 7&9
hey what do you think of the tank design?
Well thanks for any help and also thanks to someone whose name i cant remember for giving me the code i already have used.
Martin
Last edited by RegalKnight; 03-05-2003 at 02:03 AM.
Does anyone know if using hitTest with bounding boxes is less or more cpu intensive than writing your own function to do the same thing?
I'm just wondering which is "better".
The bounding boxes will be faster then writing a WHOLE function, although I don't think it will be a big difference...
But you don't need a function for the hittest the:
hi guys,
i have been hearing interesting things with this hitTest. ive also tried to put empty mc's on the corners of the car (or tank im my case). this is what ive added into the tank code:
Code:
// hitTest with the rocks
if (_root.tank.boundary.hitTest(_root.land)) {
speed *= -.5;
}
y doesnt that work - it goes into like the centre of the tank still:S thanks for your help...
i am testing a newcool game kinda like snake. in the game you are suposed to catch all the red balls but you always leave a grey wall behind you, and if you hit it, you die!!! uses a whole lot of hittests. i just learned that if you gave two movieclips the same instance name ("wall" in my case) and you try to hittest another mc to them, it wont work, not as:
Code:
//this is in the "wall" mc
if(this.hitTest(ship){
//something
}
or:
Code:
//this is in the "ship" mc
if(this.hitTest(wall){
//something
}
1. make a bar and give it the instance name healthBar
2. put in this code
onClipEvent(load) {
_root.healthBar._width=100
}
onClipEvent(enterFrame) {
if (enemy attacks you, whatever happens - put in the code here) {
_root.healthBar._width-=10
}
if (_root.healthBar._width<=0){
you die
}
}
I've gone through the messages in this thread and I don't think that there was anything that specifically helped me with this, so I thought that I would ask in case anyone could help me!
Essentially, I want to have the player control an object that will follow a sloped track when they press the right arrow key (a roller coaster), but the track is random. They would be able to jump up off of the track briefly, and set back down. Having a character run along a straight area is easy, but what about slopes?
ironclaw: remember to put the box which will be the health bar on the side of the centerpoint, or else its width will be decreased from both sides (towards the center point).
Takysa: can you upload the file or give a better description, as i didnt understand what u meant.
What I mean is that I want the movie clip to travel along the shape of the track, like when you're on a rollercoaster. So, rather than just changing the x axis of the player if he's walking along a flat surface, I'm changing the y as well to correspond with the shape of the track. They go from left to right, with dips and crests along the way. However, I don't know how to best tackle this, because the track is not going to be one single movie clip; it will have sections that are random so that the track is never the same.
If I can get a visual for what I want to do, I'll post it.
there are two ways to do that (which i know of):
the graphical: you can put the track inside another mc, and then hittest it that way. this of course depends on how big your character is:
the mathematical:You get your characters _x and uses this _x to find the _y of the track underneith him. then see if their _y's the same and move him up if they are. To find which part of the track is at that _x, you can make them all 5 pixels wide and call them trackx1, trackx2 trackx3... Then you get the _x of your character and divide it by 5 and put it in a varable (eg current_X):
I need some hittest help. I have a game that needs to have accurate collisions. The only two I know of are if(this.hittest(object1)){Blah Blah Blah} which has the bounding box limitation and if(this.hittest(object1._x, object1._y, true){Blah Blah Blah} which did not seem to accurately pick up what was transparent and what was not. (Don't ask why?)
If you want to see what I mean (uses: if(this.hittest(object1._x, object1._y, true){})
Just so you know, the shields that appear when they collide should come up at aprox the same time (they are colliding, right!) and its obvious they don't unless they hit each other dead center.