Any way to constrain actors together without creating global Game Attributes?
Hi there!
I'm making a game where I have waves of enemy actors being spawned and I would need a way to constrain actors (position and rotation) with the spawned actors.
I've seen it done in several games and found a few tutorials but all methods I've seen require the creation of several Game Attributes for every enemy (code would get a bit bloated with a horde of enemies...).
Can the code be done inside the spawned actor or the actor that will be constrained or with the least amount of unique Game Attributes for each enemy?
The application would be to make arrows, axes and daggers shot, stick to enemies wherever they are struck.
It would also allow me to equip the spawned actors with equipment that would for instance drop and be discarded once hit (an axe could get stuck to a shield carried by one of the spawned enemies, making the enemy drop it and become vulnerable to the next shot).
There are so many applications and possibilities for this besides equipping and customizing spawned enemies... if there is a way to do this I would really appreciate if someone could tell me how to do it.
Thanks in advance!
Comments
Have you tried to spawn another actor(relative to enemy position) inside the enemy actor, that has the same speed and rotation of the enemy?
http://www.arcaderz.com
You could use tables for such a thing i'd imagine, storing X and Y position data in real time would require a loop of some sort though.
basically changing table values every 0 seconds or something to the local actors x,y,rotation
Then on the constrained objects you can constrain the self.x, y, and rotation attributes that exist already to those table values.
I don't know that this method would be any less bloated however in terms of actual code amount required, but certaintly less attributes used.
Follow us: Twitter - Website
I though that maybe tables could be used in some way if I assign cells to store position and rotation of each spawned enemy and every spawned projectile but It seems very complicated when different projectile actors and enemies are taken into account. The table would have to be huge or maybe I would have to have a lot of tables wouldn't I?
I'm still not very good at working with tables and advanced expressions so I'm really stuck on this one. And it seems to be used a lot on archery games (arrows get stuck everywhere, waves of enemies, the ground, etc...)
It would be great if there was a way to reference or access data (position and rotation) from other actors through expressions or some other clever use of tables or other workarounds.
The spawning an actor inside the other actor with the same position and rotation solution would need the global attributes as well wouldn't it?
Thanks for the comments! I hope we can figure this out, it has so many applications! (fire balls orbiting an actor, HP bars hovering over each one, enemies with speech/thought bubbles, etc...)
See my video on scene linking actors.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
That video was very helpful, using the layer data to constrain will surely be very helpful in my projects, thanks! I just could nor figure out how to use it with the spawned actors (arrows, enemies) because they are not on the scene at the beginning so I don't have access to their positions and rotations from the layers tab. Any suggestions? (Great videos by the way! Will check them all out!)