Why do objects fair way off the screen not move on scene start?

I have a platformer where an NPC starts off high above the platform, and drops until it lands on the platform.

However, it seems the off screen NPC doesn’t drop when the scene starts. The NPC does start to move when the player/camera gets closer to the NPC. This is a bit frustrating, because I have a number of the NPCs positioned so that they fall within a particular pattern. But this pattern is broken because the NPCs don’t drop when the scene starts.

Is this how GDevelop works? And if so, is there a way around it to get the NPCs dropping even when they’re way off screen?

:thinking: I cannot remember any such thing in the platformer code. How high are we talking? There can be weird behavior with every number in GDevelop if it exceeds 9007199254740991.
Would you mind making a small test project to replicate this?

Are you sure that you don’t have any distance condition to move the NPCs or maybe some extension to detect if the Sprite is on screen.
Look I don’t know if is this what you’re asking I added an NPC to the Platformer example and it falls until it is in collision with GoLeft then starts to walk.

https://drive.google.com/drive/folders/1Hfurb8OFO91CeyBliudkKgG_dxKnWTls?usp=sharing

Just within a screen’s height. Nothing big.


Here’s my set up, I can share this project if needed. BlueJumper and Player are platformer characters. BlueJumper has default controls turned off. GreenFloor is a Platform.


BlueJumper animations (I’ve reduced it to one image for now, prejump normally has a pre jump animation going on) :


The events behind. I use the prejump animation to pause between landing and jumping again :


How it should work :

shouldLook


And this is how it works if I pause the movement to the right every few coins. It appears that the blue jumpers fall when they are a certain distance from the camera/player :

ActuallyLooks

I think the reason is not the platformer engine, which should work well and always running on all objects even if far from screen, but rather the fact that the events are triggering a jump when an animation is finished.

The “gotcha” seems there: animations are not played if the object is outside the screen (to avoid animating an entire level while only the objects around on the screen are visible).
Because of this, the animation “prejump” is only running when you move near the objects, and so is finishing not at the same time according to each instance and your distance from it.

What we can do is:

  1. add a warning in the condition that by default animations are not running when an object is outside the screen.
  2. add a checkbox in the Sprite editor to allow animations to run even if the object is outside the screen.

And this checkbox should solve your problem!

I had an animation sync issue a while back, and this fixed it. Maybe it can be helpful to you as well:

@4ian, thanks for the explanation. At least I understand what I’m dealing with, and can try figuring a way around it until the change is implemented in GDevelop, possibly with object timers. I look forward to the potential modifications.

@beanmatt, thanks for the link. I had a look at it; not 100% sure if I can use that work-around, as I’d possibly have to make a copy sprite for each blue sprite in the scene. Unless I can work out groups of sprites that share the same animation frame.

I’ve added an option in the next version in the sprite editor to allow an object to play its animation even when outside the screen.
Note that this comes at the cost of performance, so I recommend you update your logic to use maybe something else to trigger the jumps :slight_smile:

3 Likes