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?
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.
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:
add a warning in the condition that by default animations are not running when an object is outside the screen.
add a checkbox in the Sprite editor to allow animations to run even if the object is outside the screen.
@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