Compare the X of each object ?

0 favourites
  • 3 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • Hello,

    I am trying to do a car race for my son, he would like to have to display throughout the race who is first, second, third and last.

    It is a straight line race and participants must press a key to add a value to the X of the car.

    it is then necessary to compare the values of the X of the car 1,2,3 and 4.

    Thank you

    Have a good day.

  • This is not the most accurate approach by any means, but something you might try first:

    1. Get all your car sprites and put them in a family, call it "cars" for example.

    2. Then add instance variable to that family called "car_number" and in your layout select all 4 cars and give them unique car numbers (from 1 to 4)

    3. Create a new sprite object, call it "finish_line" (if you don't have one already) and place it at the finish... line

    4. Create a new text object, call it "leader" and place it where you want to have it shown on the layout

    4. In the events sheet do the following:

    Origin points matter in this case, so you might want to create new ones if you want further accuracy.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Another method is to add an instance variable to each car called "var_X".

    For each Car

    set Car.var_X to car.X

    Then use Car "pick highest/lowest" to pick the car with the highest X value.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)