need help getting numerous pairs of objects to work together
Hi there,
What i'm stuck on here is what if i want to have say.. a hit box graphic that is different (bigger) than the art itself.. my thought would be to have an invisible box simply move with the object. my understanding is that it would be easy with a single object to do a constraint, but what i find confusing is what if there are 10 enemies and each one needs one of these boxes to move with each enemy as its spawned. How would this be done, or maybe there is a better solution?
To better explain why i'd want a different hitbox, maybe even several would be in my case where we're talking about cars moving around. i'm working to make the cars intelligent and interact with each other as they move around, but then when it comes to bullets hitting if the graphic was too big, bullets would register hitting before they reached the graphic. however even if that could be handled differently, the real mystery to me is how to get multiple objects to "pair off" and behave individually together.. and have other "couples" do the same.
I guess another analogy would be ballroom dancing.. you have men and women.. you spawn more and more but want them to be able to connect and then move as each newly formed couple needs to move around the room.
Thanks!
Caleb
What i'm stuck on here is what if i want to have say.. a hit box graphic that is different (bigger) than the art itself.. my thought would be to have an invisible box simply move with the object. my understanding is that it would be easy with a single object to do a constraint, but what i find confusing is what if there are 10 enemies and each one needs one of these boxes to move with each enemy as its spawned. How would this be done, or maybe there is a better solution?
To better explain why i'd want a different hitbox, maybe even several would be in my case where we're talking about cars moving around. i'm working to make the cars intelligent and interact with each other as they move around, but then when it comes to bullets hitting if the graphic was too big, bullets would register hitting before they reached the graphic. however even if that could be handled differently, the real mystery to me is how to get multiple objects to "pair off" and behave individually together.. and have other "couples" do the same.
I guess another analogy would be ballroom dancing.. you have men and women.. you spawn more and more but want them to be able to connect and then move as each newly formed couple needs to move around the room.
Thanks!
Caleb
Best Answer
-
MotherHoose Posts: 2,456
@part12studios … ah … the designPhase of a game!
what really has to be in the scene at load time?
we just so automatically place things like the background; score; timeDisplay; start/reset buttons; back/next buttons; playerCharacter … etc.
and … perhaps we should rethink those choices when doing the scene layout…
in your scenario the enemies and their hitSensors are functionally interactive …
so the 10 enemies should be given offScreen locations and null images
with 1st behavior: changeAttribute: self.Image To:
then add the sensors for those enemies unlocked … with correct constrains
having 20 or more actors without imageDrawing at load time is very fast
let a controlActor handle the spawn of the background/other actors from prototypes
… even the player can be spawned when its rules/behaviors are intense
actors in a HUD layer … can also be spawned by an actor in that layer
… or another controlActor in the HUD layer
layout the scene with all elements in correct layer and position
decide what can be spawned … create controlActors to do spawns
when ready … delete the spawnedActors from the scene
MH
Answers
For the second part, if you want them to pair up like in your ballroom dancing analogy you can assign each type of actor a variable to describe them like man=true or woman=true or make a single integer where each value represents a type and then check for that in your collision rule. Man=1 woman=2 etc. Does that make any sense?
@jn2002dk yea the constraint thing sounds good, but it seems like this is only good for one object.. if i have a spawner cranking out bad guy after bad guy, how does each new hit box know how to pair off with the right object? I can spawn a car to appear and to have that car spawn a hit box actor on top of it, but then it would leave the box behind because the box doesn't know to stick with it. With the 2nd part, my analogy was mostly to drive home the same issue of having unique one item stick with another dynamically.. each time a new male dancer is spawned, he would have an accompanying female dancer who moves with him as a "child" of the male dancer..
@MotherHoose so are you suggesting i not use a spawner but instead have a stage with pre defined enemies off stage that just get called on at certain times? I can see how unlocking numerous unique objects on the screen would be a solution.. because then i could access info from other objects in the stage.
Thanks so much for the feedback!
Yea, i understand now. Sounds like MotherHooses solution is the way to go
its just so nice to have a "fire and forget" spawner kind of system. oh well
Thanks!