hello everyone I am creating a game where you click on enemies to hurt them what the best way to create a cover system so if you click on an enemy but if there is another sprite in front it will not hurt them
Mouse On Click object Enemy Mouse cursor is NOT over CoverSprite Enemy subtract 1 from health
but here is the problem if the cover sprite is behind them you still can't hurt them is it possible to say if the cover is on a layer higher than enemies and you click on the cover and enemy it won't hurt the enemy
Develop games in your browser. Powerful, performant & highly capable.
You can try something like this:
Mouse On Click object Enemy System pick CoverSprite by evaluate CoverSprite.layerNumber >Enemy.layerNumber Mouse cursor is not over CoverSprite Enemy subtract 1 from health
so so sorry for the delayed response I am working full time right now and I only just now got a chance to give it a try I am still very new to this and I am not entirely sure I understood the code here what I did it does not seem to work where am I going wrong
Try to change the first condition to "On object Enemy clicked", and remove "Cursor over enemy". If this doesn't help, please post your capx.
drive.google.com/file/d/17xdRLI8N4em7v7iF8YxQ3_pwkRN_zCJz/view
thanks buddy I use quite a few plugins and behaviors and effects so I have included them as well
I don't want to install all those addons, sorry. Also, you need to post .capx file, not .caproj
Try this demo I made:
dropbox.com/s/s6yh2grtjh34sut/EnemiesInCover.capx
perfect just perfect thanks