Goity
VIP Sleaze
Firsty, How do you make sprites appear below other sprites?
Secondly, How do you make things only activate once per click?
Thirdly, Here is the code of one of my new games.
Neither of my collisions work! any way to fix this?
Secondly, How do you make things only activate once per click?
Thirdly, Here is the code of one of my new games.
Code:
Program KDGP;
Global
FPGGAME;
IDCHARA;
PLYLIVES=3;
sheepses=1;
GY;
GX;
moo;
Shott;
i;
m;
Private
Begin
Set_mode(m320x240);
FPGGAME=LOAD_FPG("kdgp.fpg");
idchara=KD(160,100);
Sheep(250,120);
start_scroll(0,0,900,0,0,0);
scroll.camera=idchara;
While(Not Key(_tab))
FRAME;
END
END
Process KD(x,y);
PRIVATE
min_x=10;
min_y=20;
max_x=589;
max_y=379;
incx,incy;
BEGIN
Graph=5;
X=160;
Y=100;
ctype=c_scroll;
Loop
GY=y;
GX=x+150;
If(Key(_Control) AND NOT shott)
Shot(x,y);
END
IF(KEY(_left))
moo=1;
if(x>180 and x<420)
m=1;
END
If(y>350)
For(Graph=2;Graph<5;Graph=GRAPH+1)
Frame;
End
Graph=2;
x=x-13;
END
x=x-4;
END
IF(KEY(_right))
Moo=0;
if(x>180 and x<420)
m=-2;
END
If(y>350)
For(Graph=5;Graph<8;Graph=GRAPH+1)
Frame;
End
Graph=5;
x=x+13;
END
x=x+4;
END
IF(KEY(_Up))
y=y-4;
if(X>120 AND X<280)
i=1;
END
END
If((y=<370)and not(moo)And Not Key(_up))
if(X>120 AND X<280)
i=-2;
END
For(Graph=10;Graph<12;Graph=GRAPH+1)
Frame;
End
Graph=10;
y=y+14;
END
If((y=<370)and(moo)And Not Key(_up))
For(Graph=8;Graph<10;Graph=GRAPH+1)
Frame;
End
Graph=8;
y=y+14;
END
x+=incx;
y+=incy;
IF (x<min_x) x=min_x; END
IF (x>max_x) x=max_x; END
IF (y<min_y) y=min_y; END
IF (y>max_y) y=max_y; END
GY=y;
GX=x+150;
Frame;
END
END
PROCESS SHOT(x,y);
PRIVATE
FLGCOLLISION;
F;
BEGIN
Shott=1;
Graph=15;
FlGCOLLISION=COLLISION(TYPE SHEEP);
if(y>120 and y<280)y=120;end;
if(y>280)y=y-160;end;
if(x>160 and x<444)x=170;end;
if(x>444)x=x-280;end;
If(moo<1)
F=x+160;
For(x=x+40;x<600;x=x+50)
FLGCOLLISION = COLLISION(TYPE Sheep);
For(Graph=15;Graph<18;Graph=GRAPH+1)
Frame;
End
If(FLGCOLLISION)
SIGNAL(TYPE SHEEP,S_KILL);
END
If(x>F)
Shott=0;
SIGNAL(TYPE SHOT,S_KILL);END;
IF(x>230)
Shott=0;
SIGNAL(TYPE SHOT,S_KILL);END;
END
END
If(moo)
flags=1;
F=x-160;
For(x=x-40;x<600;x=x-50)
If(x<F)Shott=0;SIGNAL(TYPE SHOT,S_KILL);END;
FLGCOLLISION = COLLISION(TYPE Sheep);
For(Graph=15;Graph<18;Graph=GRAPH+1)
Frame;
End
If(FLGCOLLISION)
SIGNAL(TYPE SHEEP,S_KILL);
END
If(x<F)
Shott=0;
SIGNAL(TYPE SHOT,S_KILL);END;
IF(x>230)
Shott=0;
SIGNAL(TYPE SHOT,S_KILL);END;
END
END
END
PROCESS SHEEP(x,y); //the main enemy in the game.
private;
FLGCOLLISIONE; //setting collision variable
E; //Random x variable
F; //random y variable
BEGIN
Graph=24; //setting the picture
FLGCOLLISIONE=COLLISION(TYPE KD); //setting collision variable
loop //starts the continuous commands
IF(FLGCOLLISIONE)
PLYLIVES=PLYLIVES-1;
WRITE_INT(0,270,0,0,OFFSET PLYLIVES); //Makes you lose one life if you make contact with the sheep
END
if(i and y<315)
y=y+4; //these two stop the sheep from following you whilst scrolling
i=0;
END
if(i<0 and y>4)
y=y-4;
i=0;
END
if(m)
x=x+4; //these two stop the sheep from following you whilst scrolling
m=0;
END
if(m<0)
x=x-4;
m=0;
END
If(x>0)
E=rand(-15,0);
x=x+E;
END //These control the sheep to move around randomly within the screen
If(x<320)
E=rand(0,15);
x=x+E;
END
If(y>0)
F=rand(-30,0);
y=y+F;
END //These control the sheep to move around randomly within the screen
If(y<240)
F=rand(0,30);
y=y+f;
END
FRAME; //Keeps the sheep around
END //ends loop
FRAME;
END
Neither of my collisions work! any way to fix this?