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]
Here's the result for now:
I spawn the cockpit like this:
Any idea how I can make a efficient first person shooter phase?
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
}
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