Announcement

Collapse
No announcement yet.

[HELP] RTS Style "Selected Object" Blueprint

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [HELP] RTS Style "Selected Object" Blueprint

    TL/DR: I want to make it so that when I select a tile it becomes highlighted, and then when I select another tile it un-highlights the previously selected tile and said 'another' tile becomes highlighted instead. Can't figure it out for the life of me.

    Hey everyone, I'm fairly new to Unreal and only just barely working things out.

    So long story short I'm working on a top-down tile based game, where the player controls a character via the tiles on a playing board. I have set it up so that when the mouse hovers over a tile it highlights it by changing it's material, this is working all fine. But now I've created a select function using Event ActorOnClicked, which again works fine. When I click on a tile it toggles the material, showing it's being selected and deselected. However, I want it so that when you select one tile and then select another the previous tile will automatically be deselected. For example, when the player clicks Tile A it turns orange. When the player then selects Tile B it turns orange and any other tile(s) that were previously selected turns white. That's the kind of thing I want, but I can't figure it out. Any help would be amazing, thanks.

    This is the blueprint I have made so far if it's any help.
    Click image for larger version

Name:	BP.PNG
Views:	1
Size:	122.3 KB
ID:	1187797

    Thanks.
    Last edited by temple1997; 07-13-2016, 06:40 PM.

    #2
    Bump, any help would be great.

    Comment


      #3
      You would need to have a variable that has the actor instance of the last clicked actor. When you click on on it (the above ActorOnClicked Event), set that variable to this actor.

      Then, add a new branch to check if the clicked actor = the last clicked actor, if not, change the material on the last clicked actor before switching the material on the newly clicked actor then set the newly clicked actor to be the last clicked actor.

      Comment

      Working...
      X