How to make one Active object stay attached?
Hey, folks!
(I have been doing lots of posting of the forum today!)
I have another question I'm hoping someone with more experience than me can help me with.
For this game I'm developing, I have a spaceship. When the player uses a keystroke to propel the spaceship, I want a "fuel burn" to display behind the spaceship.
Right now, for the Active object which represents the spaceship, I have a separate animation frame which is called each time the particular keystroke is depressed. However, using this method doesn't display the "fuel burn" frame very often (perhaps because the spaceship turns by angles and not from directional frames).
So, I have a second Active object which I'd like to display at the "rear end" of the spaceship when the appropriate key is depressed. While I can have the second Active object always match the angle of the first Active object, I am having a hard time finding a way to keep the second Active object "on the backside" of the spaceship. (Since the spaceship is turned with angles, it really only has one direction.)
I tried using a Sticky object, but in run-time the application would crash due to the Sticky object (I would receive a run-time error saying so). So, I'm now at a loss.
One thing I could do (which would be a bit of effort), is that I can specify that "when the spaceship is in a particular set of angles, position the second Active object in X/Y coordinates" (which would match the back-end of the spaceship). Needless to say, though, this would be tedious to implement.
I was wondering if there are any other ideas in how to implement this?
Thank you for helping such newbies as myself! I very much appreciate it!
Most graciously...
RGBreality
Re: How to make one Active object stay attached?
How about the Particle Spray Extension?
Marv
Re: How to make one Active object stay attached?
You can also do some very simple trig to do it ;)
Re: How to make one Active object stay attached?
Set action point to the tail of the ship, the place you want the fuel burn to come from. Place the fuel burn's hotspot roughly in the center. I don't know what it looks like, so use your judgement. Add a new event:
Always->
-Set Position ("Fuel Burn") relative to (0,0) from ("Spaceship") (action point) [in the settings you can set something relevant to both hotspot or action point]
-Set Angle ("Fuel Burn") to Angle("Spaceship")
Re: How to make one Active object stay attached?
Watermelon786 is sugggesting pretty much what I would do... I'd create the fuel burn frames on top of the image of the ship so that when I import them in MMF I can give them the same exact hotspot position. THen simply set the angle and opsition of the fuel burn to match the ship's hot spot at all times.
In other words, even though there would be a lot of blank space in the images, the fuel burn frame images should be the same size as the ship images,. and the ship images would need to be big enough to fit the fuel burn where they belong. Once everything is imported into MMF, AND you have proterly set the hotspots, you can then crop all the blank space from all the frames so theres no waste of memory or drawing time.
I hope this makes sense.
Re: How to make one Active object stay attached?
Hey, Watermelon796!
That was a great idea! In implementing it, it works!
However, I have a new, smaller problem. When the key to released to propel the spaceship, the "Fuel Burn" Active object doesn't disappear.
When I set up the "Always" condition, I did not include a "Reappear" (or "Disappear" action). I do have a condition which states "when the 'Up' arrow is released," "turn invisible." But the second Active Object remains visible.
I'm sure it's something simple I'm doing wrong. Any ideas?
Thank you for your help!
Most graciously...
RGBreality
Re: How to make one Active object stay attached?
are you telling the second active to reappear or dissappear? if thats what you want to appear and dissappear, then you need to.
Re: How to make one Active object stay attached?
Hey, HolyMonkey!
After I have the "Always" condition, I have a "Start Frame" condition to have it be invisible. Then, when the "Up" arrow is pressed, I have it set to "Reappear." Yet another condition states that if the "'Up' arrow is not pressed," to "turn invisible."
When the frame starts, the "spaceship burn" is indeed invisible. And when I press the "Up" key, the "spaceship burn" Active object does appear. But when the "Up" key is released, the "spaceship burn" Active object doesn't disappear.
RGBreality
Re: How to make one Active object stay attached?
if you have ity set up as you say it should work.. I do stuff like that all the time, so I know its not a bug in MMF. Care to post or share an MFA file?
Re: How to make one Active object stay attached?
Ah, I discovered what the problem was... And it turns out that the results I had expected from Watermelon786's suggestion didn't work out.
Previously to trying this, I had set up a separate animation frame that included the spaceship with the burn. For some reason, this animation frame was displaying even though I had removed the "change animation" action for that Active object. To fix this, I removed that animation frame entirely from the Active object.
Then, when I tried having the "burn" Active object always remain in the position with the spaceship, the "burn" object didn't behave as expected. It would properly angle with the spaceship, but it would always remain "south" of the spaceship, even if the spaceship angle turned/rotated. So, if the spaceship was pointing "south," the burn would appear from the nose of the spaceship instead of the rear.
It always remained in an absolute position in regards to the spaceship, rather than rotating around with the spaceship.
Perhaps I did something wrong in implementing this?
RGBreality