Dull Blade
Still Fresh
- Joined
- May 12, 2007
- Messages
- 3
Hello this is my first post and hopefully not my last post.
Here's what I want to do:
I am wanting to write a shmup in fenix so that I can use the source to compile a file that can be played in a sega Dreamcast (yes Dreamcast is fenix compatible too). Anyways I've been learning fenix for the last few day and have come up with some code for a SHMUP.
Here is my current problems:
-the bullet fire is way too fast, I need to find some way so that it will ony shoot 1 bullet every like 1/3 second (some sort of delay command is needed)
there is to alot more work to be done, I've still got to add collisions and lives but I was hoping some one could help me along the way. As of what I've hear, this i the best fenix forum about and I hope i've come to the right place for help.
here is my code:
CODE
//-----------------------------------------------------------------------
// Program: DC Shmup
// AUTHOR: Dull Blade / SKullinator (same guy depending on forum)
//-----------------------------------------------------------------------
PROGRAM SHMUP;
GLOBAL;
int steps = 0;
int shipx = 160;
int shipy = 180;
end
BEGIN
load_fpg("images\SHMUP.fpg"); // loads FPG file
SET_FPS(40,2);
SET_MODE(320,240,16);
Ship();
Quit();
loop
steps++;
enemy1(100,-20,50);
enemy2(150,-20,80);
enemy1(200,-20,100);
enemy2(80,-20,110);
enemy1(60,-20,115);
enemy2(50,-20,120);
enemy1(180,-20,300);
enemy2(140,-20,350);
FRAME;
end
END
PROCESS Quit();
begin
loop
if (key(_esc)) exit(); end;
frame;
end
end
//-----------------------------------------------------------------------
// Key input
//-----------------------------------------------------------------------
PROCESS Ship()
BEGIN
graph=2; x=160; y=180;
LOOP
if(key(_left)) x-=4; end
if(key(_right)) x+=4; end
if(key(_up)) y-=4; end
if(key(_down)) y+=4; end
if(key(_space))
shoot(x-10,y);
shoot(x+10,y);
end
FRAME;
END
END
//-----------------------------------------------------------------------
// Shoot
//-----------------------------------------------------------------------
PROCESS shoot(x,y)
BEGIN
graph=1; // loads bullet GFX
REPEAT
y-=5; //advances bullet
FRAME;
UNTIL (y<0) // will advance bullet until its y is < 0
END
//-----------------------------------------------------------------------
// ENEMYS type 1
//-----------------------------------------------------------------------
PROCESS enemy1(x,y, go);
BEGIN
if (steps == go)
graph=3;//Graphic number 3.
LOOP
y+=6; //Moves down 6 pixels every cycle
if(y>240)return;end//If the enemy is off screen, break loop.
FRAME;
END
END
END
//-----------------------------------------------------------------------
// ENEMYS type 2
//-----------------------------------------------------------------------
PROCESS enemy2(x,y, go)//peramiters are the x, the y, and at what frame it should be created
private
int orgx = 0;
boolean way = false;
BEGIN
if (steps == go)
graph=4;//Graphic number 4.
orgx = x;
LOOP
If (x == orgx+40) // determines to go left or right
way = false;
end
if (x == orgx)
way = true;
end
if (way == true) // determines to increment + or negative according to determined direction
x++;
end
if(way == false)
x--;
end
y+=3; //Moves down 3 pixels every cycle
if(y>240)return;end//If the enemy is off screen, break loop.
FRAME;
END
END
END
Here's what I want to do:
I am wanting to write a shmup in fenix so that I can use the source to compile a file that can be played in a sega Dreamcast (yes Dreamcast is fenix compatible too). Anyways I've been learning fenix for the last few day and have come up with some code for a SHMUP.
Here is my current problems:
-the bullet fire is way too fast, I need to find some way so that it will ony shoot 1 bullet every like 1/3 second (some sort of delay command is needed)
there is to alot more work to be done, I've still got to add collisions and lives but I was hoping some one could help me along the way. As of what I've hear, this i the best fenix forum about and I hope i've come to the right place for help.
here is my code:
CODE
//-----------------------------------------------------------------------
// Program: DC Shmup
// AUTHOR: Dull Blade / SKullinator (same guy depending on forum)
//-----------------------------------------------------------------------
PROGRAM SHMUP;
GLOBAL;
int steps = 0;
int shipx = 160;
int shipy = 180;
end
BEGIN
load_fpg("images\SHMUP.fpg"); // loads FPG file
SET_FPS(40,2);
SET_MODE(320,240,16);
Ship();
Quit();
loop
steps++;
enemy1(100,-20,50);
enemy2(150,-20,80);
enemy1(200,-20,100);
enemy2(80,-20,110);
enemy1(60,-20,115);
enemy2(50,-20,120);
enemy1(180,-20,300);
enemy2(140,-20,350);
FRAME;
end
END
PROCESS Quit();
begin
loop
if (key(_esc)) exit(); end;
frame;
end
end
//-----------------------------------------------------------------------
// Key input
//-----------------------------------------------------------------------
PROCESS Ship()
BEGIN
graph=2; x=160; y=180;
LOOP
if(key(_left)) x-=4; end
if(key(_right)) x+=4; end
if(key(_up)) y-=4; end
if(key(_down)) y+=4; end
if(key(_space))
shoot(x-10,y);
shoot(x+10,y);
end
FRAME;
END
END
//-----------------------------------------------------------------------
// Shoot
//-----------------------------------------------------------------------
PROCESS shoot(x,y)
BEGIN
graph=1; // loads bullet GFX
REPEAT
y-=5; //advances bullet
FRAME;
UNTIL (y<0) // will advance bullet until its y is < 0
END
//-----------------------------------------------------------------------
// ENEMYS type 1
//-----------------------------------------------------------------------
PROCESS enemy1(x,y, go);
BEGIN
if (steps == go)
graph=3;//Graphic number 3.
LOOP
y+=6; //Moves down 6 pixels every cycle
if(y>240)return;end//If the enemy is off screen, break loop.
FRAME;
END
END
END
//-----------------------------------------------------------------------
// ENEMYS type 2
//-----------------------------------------------------------------------
PROCESS enemy2(x,y, go)//peramiters are the x, the y, and at what frame it should be created
private
int orgx = 0;
boolean way = false;
BEGIN
if (steps == go)
graph=4;//Graphic number 4.
orgx = x;
LOOP
If (x == orgx+40) // determines to go left or right
way = false;
end
if (x == orgx)
way = true;
end
if (way == true) // determines to increment + or negative according to determined direction
x++;
end
if(way == false)
x--;
end
y+=3; //Moves down 3 pixels every cycle
if(y>240)return;end//If the enemy is off screen, break loop.
FRAME;
END
END
END