Thu, Oct 10, 4:29 AM CDT

Renderosity Forums / Animation



Welcome to the Animation Forum

Forum Moderators: Wolfenshire, Deenamic Forum Coordinators: Anim8dtoon

Animation F.A.Q (Last Updated: 2024 Sep 18 6:34 am)

In here we will dicuss everything that moves.

Characters, motion graphics, props, particles... everything that moves!
Enjoy , create and share :)
Remember to check the FAQ for useful information and resources.

Animation learning and resources:

 

[Animations]

 



Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Flash advanced user : Please Help Me !!!!!!!!!!!!!!!!!


remc ( ) posted Wed, 04 September 2002 at 8:00 AM · edited Sat, 03 August 2024 at 6:37 AM

Attached Link: http://www.thirdeyefunction.fr.st

Hi everybody ! Well, i have another problem for you ! I will be glad if u can help... **Ok let's start:** The player is on a 3d isometric plan (like a big room). The player move his character by clicking on the floor ( Until now i can do that, it's ok...). Here is the code i use : ________________________________ onClipEvent (load) { _x = 0; _y = 0; speed = 2; } onClipEvent (mouseDown) { targetx = _root._xmouse; targety = _root._ymouse; } onClipEvent (enterFrame) { _x += (targetx-_x)/speed; _y += (targety-_y)/speed; } ________________________________ But now, there are : a table, a trash can etc... And the player "walk" on them !!!!!! I just want taht when the "player" touch the table, he stop... Is there a way to tell the "character movie clip" to not go on the "table movie clip"? REMC http://www.thirdeyefunction.fr.st


vectortv ( ) posted Sat, 07 September 2002 at 6:04 PM

Well there are a couple of ways to action this environment. The first (and most simplest) is to use the 'hittest' function. You basically attach a movie clip to the mouse, and then when you have the on (mousedown) it checks the hittest to see if it connects with the object - you could either have it list all the movie clips on the stage and check each one, or put the movie clip names all into an array and then create a loop that checks them all. However what will happen with this way is that you only allow them to move if they don't click on an object. The second and FAR more complicated way is to use pathfinding metholodology, and here's where it gets a bit complicated. What you basically need to do is turn your stage into a grid, of tiny square, and then put your objects into movie clips and dynamically attach them to the stage, and push that into an array - at the same time you reference another array with a single variable which tells whether the user can move to this square or not for example - a 9 x 9 grid below: 000000001 000000001 000000001 000001111 110000000 110000000 000011000 000011000 000000000 The ones would identify what squares the user can't move to. Then what we do is initialise a variable to declare where the user is. When they click on the square the movie clips tells it where in the grid that is and whether the user can move to it, if not you tell it to move to the nearest square. That's a very simple way, if you wanted to work in a more complicated but cleaner image (like Diablo II) do a search for pathfinding.


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.