Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

Day 7 and counting down. 
Update 3



Documenting some of the mistrials of learning Z Order Sorting in Construct3. In this case I have figured out rudimentary Z Order sorting between player and one object. The big challenge is applying Z Order sorting to an entire family of objects and building the events efficiently so that the game does not drop frame-rates 

—————————————————-

Let’s consider three objects

  • Player 
  • A Door
  • A Blue Prop called RandomProp

For the first part of this exercise, lets focus on the player and the door. 
The player has been assigned some basic controllers. 
The Z Order Bar looks like this 


If you run the game now, the player will move behind the Door and RandomProp



Now we are going to do a conditional check.
Create a condition - where if the players pivot point.Y is greater than the door pivotpoint.Y -then resort the Z Order of the door and move it behind the player.

Quickly testing that condition we get the following results 


Ok, so it works. Initially the game checks the zorder for the three objects - the player is behind everything - so when the player moves it goes behind the door. 
Now when the player moves downwards, the player pivotpoint.Y is greater than the door’s pivotpoint.Y - so the system immediately sorts the player to the top. 
And when the player goes back to the top where it’s pivotpoint.Y is lesser than the door’s pivotpoint.Y - we have not assigned any condition so the player still stays Z Order sorted to the top and goes over the door. 

Let’s add another condition to instruct the system to check for Z Order sorting between Player and Door and display it correctly 


Small update to the event sheet. Instead of moving the Door in front or behind the Player, that has been changed to the Player now moves in front or behind the Door. I anticipate there will be many objects that have to perform the same function and this method already feels inefficient. 

-------------------------------------

When the condition exists for two objects - the system does not perform the expected behavior and the Door's sort does not work while the RandomProp's sort order works. 
I will need to research 'Sort Z Order' a bit more as the concept is new and a bit confusing