YolkfolkThe Dizzy Fansite 0 logged in0 playing
Community discussion

Pseudo-static objects?

Started by Andrey Mashinistov on 9 May 2023 • 726 views

3 posts
#91057

Hello, all!

While working on my Dizzy game, procrastinating terribly as always, I was once again reminded of the impossibility of moving static brushes between rooms in Dizzyage. {dizzy}:mad:

This subject was discussed here - https://yolkfolk.com/communityforum/postid/54606/

There Delta mentioned enabling dynamic objects to act as block brushes.

[quote data-userid="23" data-postid="67749"]

personally, if i were doing it, I'd use the code I've wrote especially for CoTM to enable dynamic objects to act as 'block' brushes, but that is rather complex coding, and involves quite a few modifications to the original code. Plus it's highly specialised for CoTM, and may not necessarily work as expected in a classic dizzy game.

[/quote]

I managed to adapt his code to suit usual player movement on a horizontal plane - this worked splendidly. Thank you, Delta! {yolkfolk}:clap:

However, I cannot devise a way to achieve the same effect blocking player movement on the vertical plane i.e. make Dizzy hit his head against an object when jumping. This is due to my lack of understanding of the "MaterialGetFreeDist(x1,y1-step,x2,y1,1,1);" function. My interest, if it is not already clear, is in creating moving blocks.

One downside of using dynamic objects is that they will always have a rectangular hit box, so to fine-tune Dizzy's interaction with a non-rectangular object would require multiple smaller rectangular objects to be placed along its border, all of which would require separate ids in order to be moved. All in all a lot of hassle, that makes one question doing this in the first place!

I am just experimenting here and am certainly not asking anyone to go out of their way to write new code for me. However, if anybody has some relevant information or suggestions I would love to hear them. I am of course aware of the work-around of using a brush in each relevant room which would be sufficient in many situations; however, it would be interesting know if anyone else conducted similar experiments and with what results? {yolkfolk}:puzzled:  

Thanks in advance! :tup:  

👍 1
#91063

This was a nice problem to think about in the bath. Reading your question again, I think you've anticipated my solution, but here it is anyway:

First turn on the custom movement and find the function CM_CheckJumpY( step )

Add a clause which only activates when Dizzy is in the room with your moving object. (Add as many clauses as you need)

Write a bit of code that calculates Dizzy's position relative to the moving object.

Somewhere in each room, inside a wall maybe, have a static copy of the moving object (mat = block) 

Use the static object's co-ordinates in the room and Dizzy's relative position from before, to calculate the co-ordinates x1,y1,x2,y2 to plug into MaterialGetFreeDist

 

Have you tried something like this?

👍 1
#91064

Thanks for the reply, Noggin!

I have tried using static copies within rooms, I did it in a somewhat simpler way than you suggest - I placed copies in all relevant rooms in the editor and programed them all to go to the main object, although they become invisible and intangible their coordinates are known, and they again become visible and tangible once their coordinates are within their home room. When crossing a room border half of one copy becomes visible in one room and half of the other copy becomes visible in the other room, allowing for scrolling. Since Dizzy is already programmed to interact with static brushes I did not need to edit custom movement in order to facilitate the desired interaction.

Maybe I have misunderstood your suggestion and failed to realise some nuance it provides, but as far as I can see using static copies in each room does away with the need for editing custom movement.

I suppose that no pseudo-static object can beat true static brushes! Thanks all the same! :tup:  

👍 0