Allowing players to place actors.

CastanetsCastanets Member, PRO Posts: 2

I've been trying to find a way of allowing the player to select ,move and place an actor, but as of yet have not been able to find clarification on how to do that. If anyone could tell me the sequence of behaviours that would allow that, I would appreciate it.

Comments

  • MentalDonkeyGamesMentalDonkeyGames Member Posts: 1,276

    One method:

    Create a button that spawns the actor you want the player to place.

    Rule:
    When touch is pressed
    Spawn actor (the actor that you want the player to place)

    In the actor that the player is placing, create a new self.attribute (boolean), call it "placed" and leave it to false by default.

    In the actor, have a rule:
    Rule (all conditions valid):
    -When game.mouse button is down
    -When self.placed is false

    Constrain self.position x to mouse x
    Constrain self.position y to mouse y

    Rule:
    -When game.mouse button is up

    Change attribute self.placed to true

    If you have other rules in the placed actor, just wrap them in a rule that says When self.placed is true.

    Mental Donkey Games
    Website - Facebook - Twitter

  • CastanetsCastanets Member, PRO Posts: 2

    Thanks a lot, that was helpful.

Sign In or Register to comment.