Panel goes "missing" when spawned by player facing the opposite direction.

MysticalMist

Active member
I have a character whom uses a special move that's essentially the blinding light move from Orochi (KOF). The light animaton is spawned in the form of a panel. Pretty straight forward stuff.

Code:
name lightattack
health   0
type  panel
speed 10
alpha 1
setlayer 255
lifespan 15

However, when the panel is spawned using this spawn05 code below, it works when the player is facing one direction, but in the other, it is not visible (and if so, maybe for like a frame or two at most).


Code:
void spawn05(void vName, float fX, float fY, float fZ)
{
    //Spawns entity based on left screen edge and z axis
    //
    //vName: Model name of entity to be spawned in.
    //fX: X distance relative to left edge
    //fY: Y height from ground
      //fZ: Z coordinate

    void self = getlocalvar("self"); //Get calling entity.
    void vSpawn; //Spawn object.
    int Direction = getentityproperty(self, "direction");
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int Screen = openborvariant("hResolution"); // Get screen width

    clearspawnentry(); //Clear current spawn entry.
      setspawnentry("name", vName); //Acquire spawn entity by name.

   if (Direction == 0){ //Is entity facing left?                
      fX = Screen-fX; //Reverse X direction to match facing and screen length
   }

    vSpawn = spawn(); //Spawn in entity.

    changeentityproperty(vSpawn, "position", fX + XPos, fZ, fY); //Set spawn location.
    return vSpawn; //Return spawn
}

I have text entities that rely on spawn05 that also take up the screen. The problem is that they also struggle with the same thing. I know it has something to do with the fact it's based on the left part of the screen, but all I want is to be able to spawn either a text or panel entity on a fixed position of the screen, regardless of the player's direction.
 
Last edited:
Maybe adding “facing 1” would solve the problem?

facing {int}
This is for forcing the entity to face certain direction regardless where he/she is going.
0 = no force (default).
1 = force the entity to face right.
2 = force the entity to face left.
3 = force the entity to face same direction with level's direction.
Setting this allows players to play BACKWALK.
 
I usually use spawn05 to spawn background effect at center of the screen and have the effect entity offsetted at the center of its sprite. This way it doesn't matter if the spawner is facing right or left.
facing setting is only set for certain effects.
 
I've tried using the facing in various manners. I
I usually use spawn05 to spawn background effect at center of the screen and have the effect entity offsetted at the center of its sprite. This way it doesn't matter if the spawner is facing right or left.
facing setting is only set for certain effects.
Yep, turns out my main issue was just not setting up the entity offset correctly. Thanks guys!

I'm very sorry in advance for all of these basic hiccups, you have no clue how long I spent last night trying to figure this out and somehow completely overlooking the offset 😅
 
Back
Top Bottom