Help And That


Goity

VIP Sleaze
Joined
Jun 22, 2004
Messages
5,598
Location
Isle of Ewe
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.


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?
 
Sorry, Goity, but your first two questions have been answered before, you could have done a little search.


1. Every process has a z value, something like a coordinate. z=1 is the highest on screen, on top, and every bigger z is below the other.

2. You can do that easy by tricking. Search around the fenix board, there were some methods posted :)

3. Didn`t know of the way you are doing this, but did you try something like that:

Code:
if(collision (type sheep))
  "do something!"
 end;

Thats how it works for me.
Didn`t take a closer look at your code,
so I don`t know if something else is wrong.
 
Code:
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

This part has a problem, it's checking the collision when the process begins, but not in the minalopp, so the collision is always false.

Change it to this.

Code:
BEGIN 
Graph=24;        //setting the picture

loop        //starts the continuous commands
IF(COLLISION(TYPE KD))
PLYLIVES=PLYLIVES-1;
WRITE_INT(0,270,0,0,OFFSET PLYLIVES);   //Makes you lose one life if you make contact with the sheep
END
 
Quiest posted on May 12 2005 at 10:34 PM said:
Sorry, Goity, but your first two questions have been answered before, you could have done a little search.


1. Every process has a z value, something like a coordinate. z=1  is the highest on screen, on top, and every bigger z is below the other.

2. You can do that easy by tricking. Search around the fenix board, there were some methods posted :)

3.  Didn`t know of the way you are doing this, but did you try something like that:

Code:
if(collision (type sheep))
  "do something!"
 end;

Thats how it works for me.
Didn`t take a closer look at your code,
so I don`t know if something else is wrong.

Heey! I did try searching! Do you know how hard it is to dsearch for something as vague as making sprites appear below other sprites?

Anyhoo, Thanks Y'all, I'll try these later when I can get on the desktop pc.

EDIT: Y'arr!!!! It's working now half the time, but my shot is still sucking donkey mush! I tried the same Idea with that.
 
Last edited by a moderator:
I sorted out my shot, I had to put the collison inside the graphics for, but the sheep is still fooked up.
I did try looking in the forums and I remember the first question, but I just couldn't find it!!!
 
Yeah, it`s okay, let`s forget about that :)

If you tell us what the sheep is supposed to do, and what it actually does, maybe we can help you better.

I most of the time find the errors in my code after playing around in the game and looking when what happens. Then I try to track the error down...
 
You told him mostly what I told him :) you just said it with more detail :D So, yes, it should have helped.
 
I don`t really know what your problem is, but it is funny to see that tyranno shoot fire out of his arse when walking backwars (pressing up & in the opposite direction that beat is facing :D)

I think it should be somethin about your sheep making those random movements...
 
Quiest posted on May 15 2005 at 10:23 PM said:
I don`t really know what your problem is, but it is funny to see that tyranno shoot fire out of his arse when walking backwars (pressing up & in the opposite direction that beat is facing :D)

I think it should be somethin about your sheep making those random movements...
It's a special move, I assure you :unsure:

Do you have any ideas about how to fix this? Maybe making him move in a fixed pattern?
 
Last edited by a moderator:
Quiest posted on May 16 2005 at 10:32 PM said:
The sheep or the tyranno?
I would have to think a bit for a solution of the sheep.
The collision between the sheep and the tyranno
 
Last edited by a moderator:
I`ve looked twice through the source but I can`t find the problem why it`s happening.

Maybe if you get around to it: give your code a little sorting and structuring and maybe a little documenting and I`ll have a new look :D
 
Quiest posted on May 26 2005 at 09:10 AM said:
I`ve looked twice through the source but I can`t find the problem why it`s happening.

Maybe if you get around to it: give your code a little sorting and structuring and maybe a little documenting and I`ll have a new look :D
I'd love to, but I'm travelling to France in half an hour.
 
Last edited by a moderator:
Back
Top