Object positions

Hello everybody,

I would be pleased to understand how things work in the TWP engine, I have 3 questions:

  • I just wanted to know if someone has figured out how the positions of the objects are defined? If we look to a wimpy file it seems that the position is defined by the “pos” value and relative to the left/bottom (?) corner of the screen, but the image (or sprite) corresponding to the object (defined in the json file) is centered to this position or translated by the spriteSourceSize.x and spriteSourceSize.y? Or is it something clever than that?
  • What is the use of the zsort of a room’s layer? Are the objects and layers sorted by their zsort property in the same array?
  • I didn’t really understand the purpose of the “prop” property of an object, I know it has been said here: https://blog.thimbleweedpark.com/wimpy but still what does that change for an object, its position?

I’m really sorry if it’s not clear.
Thank you

A “prop” is basically an object with no interactions. It could have been part of the background and having a “walk behind mask” (as it happens e.g. in AGS), but it’s surely better to put an actual object. The problem is, you don’t want the cursor to interact with the rope, so… it’s a prop. It’s there for the scene, but not for the player.

I don’t know internally, but the zsort specifies the drawing order of all layers and objects. I suppose the array is sorted by decreasing zsort and then the engine draws on screen all objects in a sorted way.

If you look at the JSON you find an entry “pivot”, which most of the time is 0.5 for x and y. I would say this pivot defines where the anchor position is relative to the object’s size, so 0.5 means in the middle. I can suppose the room doesn’t care what the pivot is, it just says “position your pivot here”, then the actual sprite is translated so that the pivot corresponds.
For example, in my engine I had all pivots in the middle of x but in the bottom of y, because it helped me define the position as where the feet of the player were. But my library expected me to position sprites according to their topleft corner. So there was a two-step translation, the “object” was brought to the given position, and the sprite was shifted upwards and leftwards.

1 Like

Thank you @Guga

OK now I understand what is a “prop”.

It seems to be more complicate than that, actually there is a method called objectParallaxLayer, I suppose that it allows the object to be drawn in the layer specified in argument. For example


objectParallaxLayer(bridgeWater, 1)

About the objects position, if I try to display the objects of the ‘Bridge’ room for example, some objects are not drawn at the correct positions as you can see in this screenshot.

Or in the QuickiePal:

Hello everyone,

since last time, I made some progress as you can see here:

I want to share my project with you: github
I know there is still a lot of work to do, but this is just a beginning, right ?

Tell me if you’re interested or not, or if you have some questions.

2 Likes

Is engge a recursive acronym like engge game engine?

Right, it means “Engge is Not Grumpy Gamer Engine”

2 Likes