Panel entities are known to exhibit the behavior of shaking when used as fixed elements on the screen as you move through a level (for example, an entity that replaces the GO arrow or even a custom HUID). Even following the tip of using an image with a size divisible by 4, this never worked for me.
In this example, I am using this code to replace the GO arrow with an animated entity:
The code works for both DIRECTION RIGHT and DIRECTION LEFT levels and still works in levels even if the camera moves on the Y axis.
INSTRUCTIONS:
- Extract the contents of the zip into your scripts folder, and it will look like this:
- Create your entity where this code will be applied. In my game, I chose TYPE NONE but it works the same way
- To optimize memory consumption, we are creating a redirector file - which is what should be called in the header of your TYPE PANEL entity
or
(Important - the code does not work perfectly if placed as ondrawscript)
- Open the file panel_position_actual.c, which contains comments explaining what each thing does. There are only 4 lines that matter to us:
offsetXright is the X position that the entity will be on the screen in DIRECTION RIGHT levels (needs to be calculated manually, depends on the size of your sprite).
offsetXleft is the X position that the entity will be on the screen in DIRECTION LEFT levels (needs to be calculated manually, depends on the size of your sprite).
offsetZ is the Z position that the entity is on the screen, regardless of the level type.
The last line "if (name == "arrow_left"){" gets the alias of your entity, declared in the txt of your level (and not the original name). If no alias is provided, the code will understand that the level is DIRECTION RIGHT and nothing else needs to be done. For DIRECTION LEFT levels, you need to put the alias "arrow_left" (remembering that scripts are Case Sensitive):
With this, even if the camera moves in any direction, the entity will always stay in the same position and without shaking
PS: to use this as a custom arrow, you need to replace your arrow.gif sprite (under sprites folder) for an empty image and your go.wav (under SOUNDS folder) with an empty sound file.
In this example, I am using this code to replace the GO arrow with an animated entity:
The code works for both DIRECTION RIGHT and DIRECTION LEFT levels and still works in levels even if the camera moves on the Y axis.
INSTRUCTIONS:
- Extract the contents of the zip into your scripts folder, and it will look like this:
- Create your entity where this code will be applied. In my game, I chose TYPE NONE but it works the same way
- To optimize memory consumption, we are creating a redirector file - which is what should be called in the header of your TYPE PANEL entity
or
(Important - the code does not work perfectly if placed as ondrawscript)
- Open the file panel_position_actual.c, which contains comments explaining what each thing does. There are only 4 lines that matter to us:
Code:
int offsetXright = 440; // X position, for direction RIGHT levels
int offsetXleft = 36; // X position, for direction LEFT levelss
int offsetZ = 100; // Z position on stage
if (name == "arrow_left"){
offsetXright is the X position that the entity will be on the screen in DIRECTION RIGHT levels (needs to be calculated manually, depends on the size of your sprite).
offsetXleft is the X position that the entity will be on the screen in DIRECTION LEFT levels (needs to be calculated manually, depends on the size of your sprite).
offsetZ is the Z position that the entity is on the screen, regardless of the level type.
The last line "if (name == "arrow_left"){" gets the alias of your entity, declared in the txt of your level (and not the original name). If no alias is provided, the code will understand that the level is DIRECTION RIGHT and nothing else needs to be done. For DIRECTION LEFT levels, you need to put the alias "arrow_left" (remembering that scripts are Case Sensitive):
With this, even if the camera moves in any direction, the entity will always stay in the same position and without shaking

PS: to use this as a custom arrow, you need to replace your arrow.gif sprite (under sprites folder) for an empty image and your go.wav (under SOUNDS folder) with an empty sound file.