-
TD
Hi, I'm doing a tower defence game. I have one tower to choose on the side of the screen. If I click it how can I place it? And also when I place it I want a range area object to be set around the tower, how? :S
And one more, If I click my placed tower, I can click it and my range object will change to "reappear" and then "set semi-transperant. Is there an condition similar to "If left-click on anything except "Tower" then..." I'd like to find anything to do it :)
Thnaks
-
Re: TD
You could try use the drag object plug-in or just simple use
'repeat while mouse button pressed
+mouse overlapping object
set object x,y to mouse x,y + the offset
Just always set the range object at 0,0 from the tower
Last one I don't understand very well but;
'User click mouse button
+negate mouse pointer over the object
-
Re: TD
How can I do "set object x,y to mouse x,y + the offset"?
-
Re: TD
Always:
-Set X Position to XMouse
-Set Y Position to YMouse
The expressions XMouse and YMouse can be typed in or retrieved from the keyboard and mouse obejct.
-
Re: TD
Rather:
Code:
1 User clicks with left button
2 TOWER: Set active to 0
3 User clicks with left button on TOWER
4 TOWER: Set xoffset to XMouse - X(TOWER)
5 TOWER: Set yoffset to YMouse - Y(TOWER)
6 TOWER: Set active to 1
7 active(TOWER) = 1
8 TOWER: Set X position to XMouse + xoffset
9 TOWER: Set Y position to YMouse + yoffset
-
Re: TD
That won't work because when the user clicks again to place the tower, it will also click on the tower again and override the first condition.
Try
* User clicks with left button on TOWER
-- TOWER: Set xoffset to XMouse - X(TOWER)
-- TOWER: Set yoffset to YMouse - Y(TOWER)
-- TOWER: Toggle flag 0
* TOWER: Flag 0 is on
-- TOWER: Set X position to XMouse + xoffset
-- TOWER: Set Y position to YMouse + yoffset