Disabling touch spawn function over other actors

GameSalad noob so please go easy, had a look around and can't seem to find the answer.

I have my game set up so that when the screen is touched it spawns my main actor (on the touch location). I want to be able to touch other 'enemy' actors that move around the screen (and destroy them), without spawning my original actor underneath them.

Also I have a pause button, which again when touched will pause, but unpausing shows the spawned main actor underneath the button.

Guessing it might be the same fix for them both. Thanks

Comments

  • Twayne2Twayne2 Member Posts: 458
    edited August 2018

    Constrain all enemmy's x and y coordinates to game attributes. Then add in your rule saying that if you press, and is not touching any of those attributes, spawn main actor. And of course say that when you touch the enemy actors you destroy them. Does this help?

  • Twayne2Twayne2 Member Posts: 458
    edited August 2018

    This should work if the enemys are already played on the screen.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    If you just want to spawn 1 main actor you could also use an Attribute starting at 0. When you spawn the main actor set this Attribute to 1 and in your spawning behaviors check the value of the Attribute, only spawn a main actor when the Attribute is 0. Something like:

    Attribute Main=0

    To spawn a main actor.

    if touch is pressed and Main = 0 spawn the actor, otherwise don't spawn.

    This is not 'real' code, just the concept.

  • Twayne2Twayne2 Member Posts: 458

    For the PC you could say if mouse position is not over an enemy actor, and if you click, then spawn main actor. Else, nothing. If you touch or click the enemy, destroy the enemy.

Sign In or Register to comment.