How do I spawn an object on the area touched?

  • Hi!

    I am trying to build a simple city-builder game.

    Is there a way to spawn an object on the X, Y coordinate that was just touched?

    Thank you!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yes.

    Create the condition "On any touch start" (if you want the object to be created as soon as the player touches the screen) or the event "On any touch end" (if you want the object to be created as soon as the player lift his finger).

    Then inside this condition you create the event system > Create object.

    Create object function takes 3 parameters.

    The first one will be the name of the layer you want your object to be created.

    The second and third one will be the X and Y of the object, in other words,it'll be the coordinates on the screen where your object will be created.

    Set x to "touch.x" and y to "touch.y"

    And that's it ^^

    hope it helps

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)