PDA

View Full Version : [AS3] Alternative method for my problem...


Andak
09-22-2008, 08:49 PM
Hello! I'm new to this forum :)
Let's get right to my problem.

OK, so I'm making this flashgame, where you control a ball in the law of physics. The point of the game is to guide the ball from start to end. So I'm making these planks, or boxes which the ball can roll on. On these boxes I run a "hitTestObject" with the ball and set's the ball's speed multiplied with (-1) if it happends. Or, the box is made of four walls and I run a "hitTestObject" on every wall and multiplies (-1) with ball.x or ball.y depending on which wall the ball hits.

This - as you might see - involve alot of programming. Is there any easier way to do this?

I hope I made myself clear!

Greetings

Andak :)

drumn4life0789
09-23-2008, 12:29 AM
Your going to need to show us your code for people to help. But what I think you need to do is call each box like box1 box2 box3. Then just put your hittest in a for loop that does all the boxes.

xdeath
09-23-2008, 07:52 AM
yes there is an easier way. put all your blocks or boxes what ever you want to call them into one movieclip give that an instance name and use that as the instance for the collisions with the character.

:) we could improve your code had you given it to us which is what drumn4life0789 was going to do i'm guessing. but basically you were asking for a different way to do your collisions which if you wanted a different method explained then no code is needed but more info is needed if you want a code such as what actionscript your using 1,2 or 3, what the instance name of your objects are, and most importantly were code is going to be put like on main character in timeline. and if we are working off an existing code we need that code and all relating info to were it's going.

see that's what we need which is why people just give us .fla files when code is needed in situations like this. but yeah i think i've solved the problem.