The Daily Click ::. Forums ::. Klik Coding Help ::. Making an object maintain position relative to another object?
 

Post Reply  Post Oekaki 
 

Posted By Message

Deathbringer



Registered
  05/07/2002
Points
  1585
28th May, 2009 at 22:02:33 -

Hi, i'm having a real problem with a very basic game of mine. I have a creation object just above the play area "shooting" enemy starships downwards. It also shoots semitransparent "jet flares" at the same time which are set to maintain position behind the ship they are created with (ie to look like they are coming from the jets). However no matter what position i set them to (relative to the ship, of course) they always stay right in the middle of the ship, it's driving me insane! anybody got any advice.

The ONLY event related to the jet flares is "if animation (of enemy fighter) stopped is playing, set position to XXX XXX relative to enemy fighter". But they ignore it completley and just stay in the middle of the fighters instead.

 
A signature

Deathbringer



Registered
  05/07/2002
Points
  1585
28th May, 2009 at 22:20:03 -

Ah never mind, sorted it!

For anybody else that happens along in future (and for me, i hope to have a bash at a GTA-ish game one day, just without any GTA elements... er it's hard to explain ). The object is now CREATED at it's position relative to the parent object (create object is used, it's not shot from the spaceship 'maker'). It has bouncing ball movement with initial direction and speed set to nothing. Then it's "always" set to the direction and speed of the parent ship, so it maintains position behind the ship where the engines are supposed to be.

 
A signature

Deathbringer



Registered
  05/07/2002
Points
  1585
28th May, 2009 at 22:31:51 -

Oops, nope, it's gona again (PS-is there no edit post feature? ).

Now if a ship is destroyed sometimes the jet flare of another ship will stop and be left behind, then start moving again once a new one appears on the screen.

Is there no way for multiple objects to be created and "tied" to each other so that they function together? If not that throws most of my game plans out of the window. It always seems to be the same with Click products - you start off with ideas but then stupid bugs cause you to have to resort to compromises or unstable workarounds... or just give up entirely.

 
A signature

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  370

VIP MemberCardboard BoxThe Cake is a Lie
28th May, 2009 at 22:58:28 -

Yep, there is an edit post feature, it should be at the top of your post, right next to the quote button.

As for positioning, have you tried this...

*Always
-Set Jet flare's position at <Certain X cooridinate>, <Certain Y coordinate> from ship? I could send you an example file if you need one.

Edited by W3R3W00F

 
n/a

Deathbringer



Registered
  05/07/2002
Points
  1585
28th May, 2009 at 23:07:48 -

Yeah i was trying that first of all. Now im using create object i'll have another go!

woohoo! it works!

Thing is i thought i was doing that to start with and the objects mysteriously "dissapeared", and turned out to be "hidden" under the ships, but now they are positioned correcrtly... wierd.

Who knows what will happen when i make the more complicated games i have planned like a manhunt-style one where the generated enemies have seeing and hearing detectors. Or a city driving one where generated cars have detectors to make them stop or slow down when there's something in front, and look before they pull out. But i'll cross those bridges when i come to them

 
A signature

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  370

VIP MemberCardboard BoxThe Cake is a Lie
28th May, 2009 at 23:09:49 -

Cool! Good luck with your game!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click