1 Move

JGary321JGary321 Member Posts: 1,246
edited November -1 in Working with GS (Mac)
I am creating a Tower Defense type game & I have it so when I click an Actor (button) it spawns another actor (the actual tower). The problem I'm having is limiting the tower so that when it is placed it is set for good. I've tried numerous things, but can't seem to make it stay for good.

I initially followed the tutorial for moving an actor with mouse, but no matter what I do it wont stay. I even set up an attribute that changes to "1" when mouse comes up & then linked that to making the actor immoveable. I am assuming the constrain actor to mouse is overriding the immoveable part. Anyone got any suggestions? Thanks for the help.

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    What you could do is have 3 actors. A movable translucent one and an immovable normal one. And the template actor.

    So you create one actor that when you have mouse down and mouse position is over, you set a game attribute saying you are about to select. Then when mouse position is over actor, mouse up, and game attribute 'selecting' is true, you set a game attribute that says you hold a transparent piece, 'selecting' is false, and it spawns an instance of that transparent piece.

    The transparent piece has rules that say if you are 'selecting' then destroy this piece. A rule that says when mouse is down, spawn immovable actor and destroy this actor. Also make sure the transparent piece is not collidable.

    I haven't tested it, but I think that should work and I hope to make a tutorial on that once I get some decent art for it.
  • JGary321JGary321 Member Posts: 1,246
    I'll try this out & create a tutorial when I can. I'm putting on the finishing touches on my Castle Defense. I'll try to upload an unpolished version on the castle defense tonight, so we can critique it.
Sign In or Register to comment.