Having an actor attack outside of its collision zone

Im sure this is simple stuff for you guys that been here awhile but as a newbie I couldn't find much in the form of posts to help me. Other developers got me where I needed to be and I wanted to share it so others can find it easier when searched

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 touch is released (this will only work activate If your actor is being dragged) you will need to be constantly updating the actors x/y locations if its constantly moving)
Change table value. Row 1 column 1 with self position x
Change table value. Row 1 column 2 with self position Y
Spawn invisible zone actor from position X (TableCellValue(your table, row 1, column 1) & Position Y (TableCellValue(your table, row 1, column 2)

I haven't found a way to destroy the invisible zone actor effiecently yet tho.. as it stands if your character is moving u will end up with alot of invisible actors so that will need fixed but..

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.