Solved Fix images on screen

Question that is answered or resolved.

kimono

Well-known member
Hi, I wish to make an animated cockpit according to idle, attack, death... and a target thats shoot enemies.
I create the target as playable character and use @O'Ilusionista a spawn script relative to screen coords:
[10:08]
Code:
void spawn06(void vName, float fX, float fY, float fZ)
{
    //Spawns entity based on left screen edge and z axis
    //Auto adjust with camera's position
    //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 YPos = openborvariant("ypos"); // Get camera 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 + YPos, fY); //Set spawn location.
    return vSpawn; //Return spawn
}
Here's the result for now:
I spawn the cockpit like this:
Code:
anim	idle
	attack	73 88 40 57 0 0 1 0 0 15
	loop	1
	delay	2
	offset	76 130
	@cmd	spawn06 "dukeidle" 0 0 0 
	frame	data/chars/Dukepit/h1.gif
Any idea how I can make a efficient first person shooter phase?
 
kimono said:
Hi, I wish to make an animated cockpit according to idle, attack, death... and a target thats shoot enemies.
I create the target as playable character and use @O'Ilusionista a spawn script relative to screen coords:
[10:08]
Code:
void spawn06(void vName, float fX, float fY, float fZ)
{
    //Spawns entity based on left screen edge and z axis
    //Auto adjust with camera's position
    //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 YPos = openborvariant("ypos"); // Get camera 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 + YPos, fY); //Set spawn location.
    return vSpawn; //Return spawn
}
Here's the result for now:
I spawn the cockpit like this:
Code:
anim	idle
	attack	73 88 40 57 0 0 1 0 0 15
	loop	1
	delay	2
	offset	76 130
	@cmd	spawn06 "dukeidle" 0 0 0 
	frame	data/chars/Dukepit/h1.gif
Any idea how I can make a efficient first person shooter phase?
Hi kimono,
What problem exactly are you having with this entity?
 
Hi Kratus and thanks for your concern. Sometimes, the cockpit entity disappears and reappears. I put this @spawn06 in every anims. It changes for special attack and death.
Here is the current demo:
https://drive.google.com/file/d/1F6UhktedRjTViam3syiOii_rv2yejbUL/view?usp=sharing
 
kimono said:
Hi Kratus and thanks for your concern. Sometimes, the cockpit entity disappears and reappears. I put this @spawn06 in every anims. It changes for special attack and death.
Here is the current demo:
https://drive.google.com/file/d/1F6UhktedRjTViam3syiOii_rv2yejbUL/view?usp=sharing
Yeah, now I understand better. I'm making some tests and will post here some suggestions in a few minutes

EDIT: kimono, here is the demo with some changes:
https://drive.google.com/open?id=1-vRl_O1s-Jli7qnTVC5usfJZ7VVgVKp6

Here are the changes in dukepit entity:

- disabled attacks in idle and walk animations to reset attacking status. Added a line "attack 0 0 0 0 0" in the last frame of the freespecial animation to make the same reset. Sometimes if you not reset attack status, the player will not hit the enemy anymore

- added "attackone" function in the freespecial to hit enemies one by one, like a shooter game (used for single shoots, not for area shoots)

- added and adjusted "setlayer" function to put player crosshair in fron of all other entities

- replaced "spawn6" scritp by spawnScreen script, that spawns the cockpit according to screen, and will be spawned at spawn/respawn animations only, not in every animation like before


Here are the changes in dukeidle entity:

- now the only entity that will be spawned is the dukeidle. The dukeattack animations are mixed in the dukeidle entity, and now the attack animation is follow1

- added and adjusted "setlayer" function to put the cockpit in fron of some entities and to prevent blinking

- added ondrawscript to detect dukepit animations and change your own animation according to your parent, defined in spawnScreen script. For example, when the dukepit is attacking an enemy, dukeidle will detect it and will change your animation together

- added beidle script to reset status to idle after an attack

- added suicide script in ondraw too, to kill self if the parent is dead too

 
But isnt it 4 player game ? How would You display other players ships, that why games like this have their own limitations., Id make one big ship and place players on it with backs towards camera or somethin.
 
Kratus: It tested and it works great! Thank you for this system :). I owe you one ;)

bWWd: It's Gino's Goldrake project; he changed recently for 1 player game, so no problem for this scene of his game.
We try to make a vertical shooter (Bloodbane helped me when I get stuck with gravity) here:

It's very interesting to know how to make a game in first person view, it can be very useful for any project who wants tu use this kind of gameplay.
I will try later to make a Road Rash scene for Openbor :).

Problem solved here thanks to Kratus ;).
 
kimono said:
Kratus: It tested and it works great! Thank you for this system :). I owe you one ;)

bWWd: It's Gino's Goldrake project; he changed recently for 1 player game, so no problem for this scene of his game.
We try to make a vertical shooter (Bloodbane helped me when I get stuck with gravity) here:

It's very interesting to know how to make a game in first person view, it can be very useful for any project who wants tu use this kind of gameplay.
I will try later to make a Road Rash scene for Openbor :).

Problem solved here thanks to Kratus ;).

Nice! I'm glad it worked. Great project, I like shooter games, and a Road Rash scene is a good idea.
 
Thank you very much to Kimono and Kratus for helping me in my project I hope to be useful in something for you someday :)
 
Kratus: Even if dukeidle is setlayer 10, the enemies are going in front of the cockpit. Any idea how set the enemies between the cockpit and the background?
I tried to change the z value too in @cmd spawnScreen "dukeidle" but with no great result too:
The link of the updated demo:
https://drive.google.com/file/d/1fZCA18IlSCWEHgKa_kaqv8eOFTrV4dxb/view?usp=sharing
 
kimono said:
Kratus: Even if dukeidle is setlayer 10, the enemies are going in front of the cockpit. Any idea how set the enemies between the cockpit and the background?
I tried to change the z value too in @cmd spawnScreen "dukeidle" but with no great result too:
The link of the updated demo:
https://drive.google.com/file/d/1fZCA18IlSCWEHgKa_kaqv8eOFTrV4dxb/view?usp=sharing
Sorry man, I thought you wanted the enemies in front of the cockpit. I will download the demo and make some adjusts

EDIT: I changed the setlayer of the Dukepit to 10000 and Dukeidle to 1000 and apparently worked well. Please try these values and let me know if it worked
 
Back
Top Bottom