Display Order ?

Hi there

I am trying to create a simple motor racing game. Imaging that there are two motors 1 and 2:

  • They run on the same line from top to bottom.
  • 1 is slower than 2

The problem is 1 displays first, 2 displays later so when 2 is going to cross over 1 ,it looks like 2 's wheels is pressing 1’s head.

How can I make image 2 behinds image 1 and when 2 's position is the same as 1’s position, image 2 is in front of image 1. [import]uid: 111309 topic_id: 24405 reply_id: 324405[/import]

If you want image 1 to be in front of image 2 you have two options;

  1. Add image 1 to the game AFTER image 2

or, easier,

  1. After adding both images, do;
    [lua]image1:toFront()[/lua]
    and it will be in front of image2.

Peach :slight_smile: [import]uid: 52491 topic_id: 24405 reply_id: 98708[/import]

I think that toFront and toBack function is little hard to control the display if i got about 5 motors.

By the way, Is it possible for an image to switch between two group? [import]uid: 111309 topic_id: 24405 reply_id: 98885[/import]

Yes you can insert the image into a second group if you wish.

You can also just add image2 BEFORE image1 in your code as mentioned above, if that suits.

Peach :slight_smile: [import]uid: 52491 topic_id: 24405 reply_id: 98945[/import]

Thank you very much :slight_smile: [import]uid: 111309 topic_id: 24405 reply_id: 99126[/import]