maxman
Well-known member
I'm trying to have the camera shift focus only on two fighters. I put the screen in the middle where two fighters are and it's fine. Even when you move away after the fight starts, it looks like the camera is following both fighters. However, it's only focusing on the player by being the center while one opponent has his subject_to_screen 1 set.
This is the camera itself.
Opponent's stage:
Code:
anim follow20 #Remain Idle
@script
void self = getlocalvar("self");
void P1 = getplayerproperty(0, "entity");
void P2 = getplayerproperty(1, "entity");
int width = openborvariant("levelwidth")/2;
int PLAY = openborvariant("count_players");
int x = getentityproperty(self, "x");
int z = getentityproperty(self, "z");
if(frame == 0){
if(findtarget(P1) || findtarget(P2)){
changelevelproperty("scrollspeed", 0);
changeopenborvariant("xpos", width);
changeentityproperty(self, "aggression", 100);
}
/*if(PLAY == 2){
killentity(self);
loadmodel("no1");
setspawnentry("name", "no1");
setspawnentry("alias", "_");
setspawnentry("coords", 0, 200, 0);
setspawnentry("health", 1);
//void e = spawn();
//changeentityproperty(e, "direction", 0);
clearspawnentry();
if(P1){
setglobalvar("Fighter1", P1);
changeentityproperty(P1, "position", width-70, z, 0); // Spawn player 1 in a specific position
changeentityproperty(P1, "direction", 1); //Face left, direction 0 for left and 1 for right
changeentityproperty(P1, "candamage", openborconstant("TYPE_PLAYER"));
}
if(P2){
setglobalvar("Fighter2", P2);
changeentityproperty(P2, "position", width+70, z, 0); // Spawn player 2 in a specific position
changeentityproperty(P2, "direction", 0); //Face left
changeentityproperty(P2, "candamage", openborconstant("TYPE_PLAYER"));
}
}*/
}
@end_script
offset 307 297
delay 2
loop 1 1
frame data/CHARS/Eagle/Eagle_0-0.png
delay 10
frame data/CHARS/Eagle/Eagle_0-0.png
frame data/CHARS/Eagle/Eagle_0-1.png
frame data/CHARS/Eagle/Eagle_0-2.png
frame data/CHARS/Eagle/Eagle_0-3.png
frame data/CHARS/Eagle/Eagle_0-4.png
frame data/CHARS/Eagle/Eagle_0-5.png
frame data/CHARS/Eagle/Eagle_0-6.png
frame data/CHARS/Eagle/Eagle_0-7.png
frame data/CHARS/Eagle/Eagle_0-8.png
frame data/CHARS/Eagle/Eagle_0-9.png
frame data/CHARS/Eagle/Eagle_0-10.png
frame data/CHARS/Eagle/Eagle_0-11.png
This is the camera itself.
Code:
name camera
type none
speed 10
anim idle
@script
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
int hres = openborvariant("hresolution"); // Screen
int width = openborvariant("levelwidth"); // Screen2
int xpos = openborvariant("xpos");
int ypos = openborvariant("ypos");
int vres = openborvariant("vresolution");
int PLAY = openborvariant("count_players");
int CountEnem = openborvariant("count_enemies");
int x; int y;
x = xpos+hres/2;
y = ypos+vres/2;
int enemy_cursor = 0; void enemy_entity = NULL();
/* for(enemy_cursor = 0; enemy_cursor < CountEnem; enemy_cursor++){
}*/
if(PLAY == 2 && hres && getglobalvar("Wait")==NULL()){
//changelevelproperty("scrollspeed", x+y);
changelevelproperty("scrollspeed", (x+21)+y);
}
if( (P1 || P2) && PLAY == 1 && hres && getglobalvar("Wait")==NULL()){
//changeopenborvariant("xpos", (hres/2)+30);
changeopenborvariant("xpos", (width/2)-160);
//changeopenborvariant("xpos", (width/2));
}
/*if(P1 && PLAY == 1 && hres && getglobalvar("Wait")==NULL()){
//changeopenborvariant("xpos", (hres/2)+30);
changeopenborvariant("xpos", (width/2)-160);
}
if(P2 && PLAY == 1 && hres && getglobalvar("Wait")==NULL()){
//changeopenborvariant("xpos", (hres/2)+30);
changeopenborvariant("xpos", (width/2)-160);
}*/
@end_script
loop 0
delay 3 #82 # 3
offset 1 1
frame data/chars/misc/empty.gif
#delay 386
frame data/chars/misc/empty.gif
#@cmd changeentityproperty getlocalvar("self") "animation" openborconstant("ANI_FOLLOW1")
frame data/chars/misc/empty.gif
anim follow1
@script
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
void T1 = findtarget(P1);
void T2 = findtarget(P2);
int Screen = openborvariant("hresolution");
int Screen2 = openborvariant("levelwidth");
int xpos = openborvariant("xpos");
int ypos = openborvariant("ypos");
int vres = openborvariant("vresolution");
int PLAY = openborvariant("count_players");
int x; int y;
x = xpos+Screen/2;
y = ypos+vres/2;
if(PLAY == 2 && Screen2 && getglobalvar("Wait")==NULL()){
changelevelproperty("scrollspeed", x+y);
//changelevelproperty("scrollspeed", (x+21)+y);
}
if( ( (P1 && T1)|| (P2 && T2) ) && PLAY == 1 && Screen && getglobalvar("Wait")==NULL()){
changeopenborvariant("xpos", (Screen2/2));
}
@end_script
loop 0
delay 3 #82 # 3
offset 1 1
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
Opponent's stage:
Code:
#### PLEASE USE BOTH THESE IMAGES AS HUD FOR YOUR PLAYER(S) UNLESS IT'S BONUS STAGE #######
fglayer data/sprites/hud_base.png -1 1 0 3 3 1 1 1 1 1 0 0 0 0 0 0
fglayer data/sprites/hud.png -1 1 0 3 3 1 1 1 1 1 0 0 0 0 0 0
###########################################################################################
bglayer data/bgs/eagle/1_0-0.png 0.085 0 0 -54 1 1 1 1 0 0
bglayer data/bgs/eagle/1_1-0.png 0.17 0 453 -79 1 1 1 1 1 0
#background/bglayer path xratio zratio xposition zposition xspacing zspacing xrepeat zrepeat transparency alpha
panel data/bgs/eagle/1_2-0.png
#fglayer data/bgs/eagle/1_3-0.png 50 0 0 317 16 1 1 1 1 1 0 0 0 0
#frontpanel data/bgs/eagle/1_3-0.png
#fglayer path z xratio zratio xposition zposition xspacing zspacing xrepeat zrepeat transparency amplitude wavelength wavespeed bgspeedratio
direction both
settime 0
notime 1
order a
#cameratype 1
#cameraoffset 0 -224
#scrollspeed 0
levelscript data/levels/levelfight.c
#load Ryu_Icon 30
light -256 -128
at 0
#spawn darkblue
#@script
void main(){
void entity = getlocalvar("self");
int width = openborvariant("levelwidth")/2;
int height = openborvariant("levelheight")/2;
changeentityproperty(entity, "position", width, 500, 0);
}
@end_script
#coords 0 500
#at 0
#spawn darkblue
#coords 391 200
#at 0
spawn empty 1
@script
void main(){
setglobalvar("Return", "Stage_Eagle");
}
@end_script
coords 0 400
at 0
spawn barricade 1
@script
void main(){
changeentityproperty(getlocalvar("self"), "position", 381, 244, 0);
}
@end_script
coords 381 244
at 0
spawn empty 1
@script
void main()
{
int P1 = getplayerproperty(0, "entity"); //Calling player 1 entity
int P2 = getplayerproperty(1, "entity"); //Calling player 2 entity
//changelevelproperty("scrollspeed", 0);
void self = getlocalvar("self"); //Get calling entity.
int width = openborvariant("levelwidth");
int half = width/2;
int hres = openborvariant("hresolution");
int xpos = openborvariant("xpos");
if(P1){
changeentityproperty(P1, "position", half-70, 200, 0); // Spawn player 1 in a specific position
changeentityproperty(P1, "direction", 1); //Face left, direction 0 for left and 1 for right
}
if(P2){
changeentityproperty(P2, "position", half+70, 200, 0); // Spawn player 2 in a specific position
changeentityproperty(P2, "direction", 0); //Face left
// changeentityproperty(P2, "health", 1);
}
changeopenborvariant("xpos", half+70); // Calling the x value point
}
@end_script
coords 0 200
at 0
#music data/music/eagle.ogg 1382535#31.350 * 44100 = 1382535
#at 110
spawn camera 1
@script
void main(){
void self = getlocalvar("self");
int width = openborvariant("levelwidth")/2;
changeentityproperty(self, "position",width, -5, 0);
}
@end_script
coords 0 200
at 0
spawn 1vs1 1
#spawn EagleE
@script
#import "data/scripts/aimove.c"
void main()
{
void self = getlocalvar("self");
int P1 = getplayerproperty(0, "entity"); // Get player 1
int P2 = getplayerproperty(1, "entity");
int map = getentityproperty(self, "map");
int x = getentityproperty(self, "x");
int y = getentityproperty(self, "y");
int PLAYS = openborvariant("count_players");
// setglobalvar("Fighter1", P1); // fill Fighter1 variable with player 1
// changeentityproperty(P1, "setlayer", 200);
// setglobalvar("Fighter2", self); // fill Fighter2 variable with this enemy
int width = openborvariant("levelwidth");
int half = width/2;
void e;
// changelevelproperty("scrollspeed", 0);
// setAIMove("nomove chase wander");
// changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW20"));
// setidle(self, openborconstant("ANI_IDLE"),1);
if(P1){
setglobalvar("Fighter1", P1);
changeentityproperty(P1, "position", half-70, 200, 0);
changeentityproperty(P1, "direction", 1);
changeentityproperty(P1, "health", 1);
setglobalvar("Fighter2", self);
changeentityproperty(self, "position", half+70, 200, 0);
changeentityproperty(self, "direction", 0);
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2")); // Eagle (enemy type)
}
if(P2){
setglobalvar("Fighter2", P2);
changeentityproperty(P2, "position", half+70, 200, 0);
changeentityproperty(P2, "direction", 0);
setglobalvar("Fighter1", self);
changeentityproperty(self, "position", half-70, 200, 0);
changeentityproperty(self, "direction", 1);
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2")); // Eagle (enemy type)
}
//changeopenborvariant("xpos", 300); // Calling the x value point
}
@end_script
health 100
#alias Eagle
coords 0 200 0
at 0
spawn Rounds 1
@script
void main(){
void self = getlocalvar("self");
int width = openborvariant("levelwidth")/2;
changeentityproperty(self, "position", width-5, 100+16, 50);
}
@end_script
coords 0 400 40
at 0
#spawn no1 1
#coords 0 200
#at 0
spawn RefPlays 1
coords 160 200
at 0
Last edited:
