The Daily Click ::. Forums ::. Klik Coding Help ::. Tower game
 

Post Reply  Post Oekaki 
 

Posted By Message

Cream Cheese



Registered
  18/12/2009
Points
  279
16th March, 2010 at 23:15:15 -

I am trying to make a tower game but I'm having trouble with the drag and drop part. Does anyone know how this is done?

 
/I .[____],
I- --'-01110-
()_) ()_)-o-)_)

OMC

What a goofball

Registered
  21/05/2007
Points
  3539

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
16th March, 2010 at 23:43:00 -

Tower game? You mean like blocks that can teeter and fall over? Are you using the Phisix object? I have an example for that, I think.

 

  		
  		

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2976

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
17th March, 2010 at 12:37:57 -

...

I think he means a tower defense game and the "defense unit"-creation issue.

EDIT:
Oops, forgot to answer the initial question! (amazing smiley, so OMC-ish)

A simple way of doing it is using an active object (identical to the unit you are creating) following the mouseXY as long as the mouse button is pressed(When it's not pressed, simply hide the active somewhere).

Use that active to check if the current position is free(i.e if the active is overlapping something or not).

If the position is free + player releases the mouse button, simply create the real unit at the active's current XY, if the position isn't free - hide the active.

For different units, simply use multiple animations or directions for the active following the mouseXY.

It's a lot more simple than it may sound, but I'm sure you get a hang of what I'm talking about.

//EE



Edited by Eternal Man [EE]

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image
   

Post Reply



 



Advertisement

Worth A Click