The Daily Click ::. Forums ::. Klik Coding Help ::. Drawing a movement path at runtime
 

Post Reply  Post Oekaki 
 

Posted By Message

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
15th June, 2010 at 14:33:42 -

How can i assign path movement to an object at runtime but also darw the path at runtime too??

I will try to explain what i mean now.

A number of balls are bouncing around on screen, Hold ing the mouswe button down after clicking on one of them and dragging causes a line to be drawn on screen which the chosen ball then follows. once it gets to the end of the line it resumes it's normal bouncing.

this is for a quick game i wanted to submit to the arcade.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
15th June, 2010 at 14:41:24 -

You could try the advanced path movement extension. It lets you draw nodes at runtime.

Don't know if it's flashified yet though.

Perhaps the MoveIt or Move safely extensions, and you program your own nodes.

Alternatively you could just save a list of mouse coordinates and move the object between them manually.

 

  		
  		

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
15th June, 2010 at 14:48:04 -

i thought that but i'm going to have multiple paths crossing each other at some point so it could get confusing. i need a way of referencing them by an ID or something so that i can make on object "stick" to the path.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
15th June, 2010 at 14:52:09 -

What about using a string parser? Append the mouse's current coordinates to the end of a string with two delimiters. E.g.: 123#456|234#345. Then you could run through the parsed string using a loopstep to get each subsequent set of coordinates?

Did you look into the extensions?

 

  		
  		

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
15th June, 2010 at 14:55:10 -

http://www.mediafire.com/?uzzmyiyvbyw

You should get the general idea. May have to be tweaked a bit.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
15th June, 2010 at 15:00:17 -

Excellent, simple, and smooth. Just need to add multiple paths. Shouldn't be too hard. Set a second value to the ball's ID and compare them on collision, or something.

 

  		
  		

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
15th June, 2010 at 15:12:44 -

Fantastic Gamester. Thanks!! now to tweak it.

 
n/a

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
17th June, 2010 at 12:45:01 -

Ok. the example from gamester works to a point.

I didn't want to do this but i'm going to have to reveal my game idea in order to help explain what i am trying to achieve.

I have got a game on my phone where you have to try and land planes on a runway by drawing a line from the plane. This is the sort of game i am trying to recreate.

Gamesters example works great with a single object on screen however problems occur with multiple objects.

What i need to do is this:

Click on the plane to start drawing the line by keeping the mouse button held down.
Click on another plane to draw a line for that one.
if another plane arrives on screen draw a line for that one. etc...

There are 2 types of plane a slower small one and a faster big one.

any number of these planes can be on screen at a time so i need to be able to get each plane to have it's own individual path.

I have got an idea about using the alt val of each plane as an identifier but i cannot implement it into the example. the other thing is that if i click on a plane which already has a path drawn for it i need to be able to clear it's existing path.

I know it's a lot to ask but i cannot think of a way to do this.

if anyone has any ideas please let me know.

Thanks

 
n/a
   

Post Reply



 



Advertisement

Worth A Click