Well we do don't we?
Anyway, I loved this game as a kid, so I decided to try and re-create it.
My aim is to only use showimg's for rendering.
I will be adding the default sound for shooting too.
There is still a main issue, of the projectile system.
But I have some form of it.
Anyway here is what I have so far, any suggestions/improvements are welcome.
PHP Code:
//#CLIENTSIDE
function onCreated(){
const Fire_Rate = 3; //Fire rate/reload time in seconds
const Rotation_Speed = 0.12; //How fast you rotate
const Max_Stars = 300;
HideGUI();
DrawBackground();
this.started = false;
this.menu = false;
this.pressedspace = false;
}
function onShowGUI(){
this.started = false;
this.menu = false;
findimg(250).alpha = 0;
findimg(251).alpha = 0;
findimg(252).alpha = 0;
findimg(253).alpha = 0;
Game_Close_Button.destroy();
enabledefmovement();
HideStars();
}
function HideGUI(){
disabledefmovement();
}
function DrawBackground(){
this.menu = true;
with(findimg(250)){
polygon = {0, 0, screenwidth, 0, 0, screenheight, screenwidth, screenheight};
red = blue = green = 0;
layer = 3;
alpha = 1;
}
GenerateStarMap();
with(findimg(251)){
text = "Press space to start.";
font = "tempus sans";
x = screenwidth/2 - text.length()*3.5;
y = screenheight/2;
red = green = blue = 1;
alpha = 1;
layer = 4;
}
new GuiTextCtrl("Game_Close_Button"){
useownprofile = true;
profile.fontsize = 20;
profile.fontcolor = {255, 255, 255, 255};
text = "Exit";
width = 35;
height = 20;
x = screenwidth - 40;
y = screenheight - 25;
thiso.catchevent(this, "onMouseDown", "onShowGUI");
}
this.starting = true;
FlickerText();
}
function FlickerText(){
if(this.menu){
this.flickermode = !this.flickermode;
}
if(this.flickermode){
while(findimg(251).alpha > 0){
findimg(251).alpha -= 0.02;
sleep(0.05);
}
}else{
while(findimg(251).alpha < 1){
findimg(251).alpha += 0.02;
sleep(0.05);
}
}
if(this.menu){
FlickerText();
}
}
function onKeyPressed(code, key, scan){
if(code == 32){
if(this.menu){
this.flickermode = true;
this.menu = false;
with(findimg(251)){
text = "Starting";
x = screenwidth/2 - text.length()*3;
}
FlickerText();
scheduleevent(2, "StartGame");
}
}
}
function onStartGame(){
with(findimg(252)){
text = "V";
rotation = 3169.91;
rotationcenter = {(screenwidth/2) +0, (screenheight/2)};
x = screenwidth/2;
y = screenheight/2;
alpha = 1;
red = blue = green = 1;
layer = 4;
style = "c";
}
this.started = true;
onTimeout();
}
function onTimeout(){
if(this.started){
if(keydown2(37, true)){
findimg(252).rotation += Rotation_Speed;
}
if(keydown2(39, true)){
findimg(252).rotation -= Rotation_Speed;
}
if(keydown2(32, true)){
if(!this.pressedspace){
this.pressedspace = true;
}
if(!this.lastshot){
this.lastshot = Fire_Rate*10;
this.rot = findimg(252).rotation;
Shoot();
}
}
if(this.lastshot > 0){
this.lastshot -= 0.5;
if(this.lastshot < 0){
this.lastshot = 0;
}
}
if(this.pressedspace){
this.moved += 15;
temp.sx = (screenwidth/2) + sin(this.rot)*this.moved;
temp.sy = (screenheight/2) + cos(this.rot)*this.moved;
with(findimg(253)){
zoom = 3;
polygon = {sx, sy, sx+zoom, sy, sx+zoom, sy+zoom, sx, sy+zoom};
layer = 4;
alpha = 1;
blue = green = 0;
red = 1;
}
}
settimer(0.05);
}
}
function Shoot(){
this.sx = (screenwidth/2) + sin(this.rot)*12;
this.sy = (screenheight/2) + cos(this.rot)*12;
this.moved = 0;
}
function GenerateStarMap(){
this.stars = null;
while(this.stars < Max_Stars){
this.stars ++;
with(findimg(253+this.stars)){
x = random(0, screenwidth);
y = random(0, screenheight);
alpha = random(0.5, 0.8);
zoom = random(0.03, 0.5);
text = "*";
layer = 4;
}
}
}
function HideStars(){
for(temp.i = 0; temp.i < 253+Max_Stars; temp.i ++){
findimg((@temp.i)).hide();
}
}
Also in need of some help with findimg's.
I have added a star map function but I can't hide them, probably a silly little error. anywho..
And Max_Stars is set as a constant of 400 if it makes any difference..
A video of this is attached in a zip folder.
I would of uploaded the avi but it isn't in the allowed list..