Clickteam Fusion 2.5

Clickteam Fusion 2.5

Restricting player spawned items
hiya.
kinda puzzled with this one (im a noob :) )
trying to allow player place items on my map, like turrets and sandbags creating items works fine
however how do i restrict the amount that i can place ?
im using a counter (as this will be used on GUI later)
upon pressing a key > create object > sub 1 from counter .
counter = 0 (now i have no idea how to stop player spawning more items)

i prolly got this wrong :)

also is there a simple way to stop item being placed on top of each other without arrays n stuff that a bit complex atm ..


thank you
< >
Showing 1-5 of 5 comments
kisguri  [developer] 18 Jan, 2015 @ 10:53am 
Where your condition for "Upon Pressing a Key" add a secondary condition "If counter is greater then 0".
perfect ,, thanks :)
Squatter 18 Jan, 2015 @ 12:43pm 
For items being placed on top of each other, you have many solutions:

1) collision detection - crude
2) If "mouse pointer over an object", do not allow an additional object to be placed.. you can even do this multiple ways, but I would just add this as a secondary condition to the "Upon Pressing a Key" and NEGATE "mouse pointer over an object." The problem you could encounter with this is that if you are on the outside of an edge of an object, you can place a new one... and they will partially overlap. Might have to add some collision detection or overlapping another object, and tell it to then move Position x and y (or just x) by 1 pixel until it is not overlapping... recommend using fast loops if you go that route. Might be other ways to fix the partially overlap but now knowing what your doing exactly I cant think of other ways.
3) there is probably other ways, but I would either do 1 or 2 above depending on what you are looking for. 1 works great if you have physics object in, and just crudely want to move things around... 2 works great if you want more control of how your game works.
Squatter 18 Jan, 2015 @ 12:50pm 
o another idea... depending on what your doing

You could possibly "grid" your game and use flags
hi squatter,

negate mouse over worked a treat, edge detection seems harder to figure out. so i cheated

""Might have to add some collision detection"" gave me an idea, physics engine + static physics , as game is a top down shooter , the effect looks pretty cool - nudges object next to it when placed and sits edge to edge , kinda please with results.

thank mate

< >
Showing 1-5 of 5 comments
Per page: 1530 50

Date Posted: 18 Jan, 2015 @ 9:29am
Posts: 5