GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Making an actor follow another actor / move to position of another actor

NspeelNspeel Posts: 17Member

I'm newer to gamesalad but I really love the platform... I've got a good start to a game so far. Thanks to gamesalad and some friendly help..

Right now I'm having an issue tho.

In my game you buy "towers (A-D)". If the player choose to theg could buy 10 "Tower-A" and 10 "Tower-D". These towers spawn into the game via attributes value (money). So the player/user could buy 10 of the same actor "Tower-A" just so we are clear. These towers aren't very big only 35x35 pixels. I need them to have a firing radius closer to 60x60 radius circle. So what I have implemented is a invisable actor "tower radius"

My issue is I need "tower radius" to spawn and move with "Tower-A". I say "move with" because the player can constant move there towers around to suit there needs SO "tower radius" must also move with "Tower-A" so it has the ability to shoot when enemies are within range.. is there a way to make this happen.. not only once but multiple times.. everytime the player buys "tower-a" spawn a new "tower radius" that will correctly follow the NEW "tower-A" and not a previous "tower-A"

I hope it was decently clear what I was trying to achieve...

Thanks in advance for any help

Comments

  • JB makin' a gameJB makin' a game Posts: 39Member, BASIC

    I replied in your other thread, because you asked it there as well. Hopefully it makes sense and if you're lucky, a more experienced person comes around to tell you how to do this properly. I just made a start for you!

  • NspeelNspeel Posts: 17Member

    Solved it. Well most of it.. I solved this issue tho by doing as follows:

    Make a table. 1 row & 2 columns. Column 1 is x axis and column 2 is y axis

    Actor A - rule
    When is released
    Change table value. Row 1 column 1 with self position x
    Change table value. Row 1 column 2 with self position Y
    Spawn actor from position X (TableCellValue(your table, row 1, column 1) & Position Y (TableCellValue(your table, row 1, column 2)

    This function can be used to do a lot I'm sure. But I used it to make an invisible attack radius for my actor.. so even tho my actor is only 25x25 pixels he will begin shooting at enemies that get into his range off 150x150 pixels

    Extremely good function for anyone wanting an npc to attack or fire outside of its actual size. Of course there is more coding involved like when bad b collides with actor A spawn actor bullet, exc, exc.. but this will help someone get closer to the final desired outcome... if there's another wat to do this I'd love to know incase it's easier than this

Sign In or Register to comment.