Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TedMar, AndrewAMD), 1,344 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: 2D Space shooter -> es will nicht funktionieren [Re: ratz] #432705
11/12/13 12:43
11/12/13 12:43
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341

laugh jetzt kann ich mehrmals schießen grin

nur hat der schuss halt keine collision mehr ...

ich guck mal weiter...

Code:
function shoot_1_event()
{
 
 shoot_1(i);
  wait(35);// MUSS, SONST KOMMEN ZUVIELE GLEICHZEITIG
 i++;	
}

function shoot_1(i)
{ 
 //if(shoot_var == 1)		
 //{
 // shoot_var = 0;	
 
 
   
  snd_play(laser, 90, 0); 

  _shoot[i] = pan_create("bmap = shot.bmp;",1);
  _shoot[i].pos_x = _ship.pos_x+30;
  _shoot[i].pos_y = _ship.pos_y-20;  
  _shoot[i].flags = VISIBLE;
    
//  shoot_var = 1;	
  
  
  
 while(_shoot[i] != NULL)
 {
  if(_shoot[i].pos_y > 5)
  {
   _shoot[i].pos_y -= 1;	      
  }
  else
  {
   reset(_shoot[i],VISIBLE); 
   break;
  }   
  
  wait(1);
 }
  _shoot[i] = NULL;	
 //} 
}




Last edited by ratz; 11/12/13 14:12.
Re: 2D Space shooter -> es will nicht funktionieren [Re: ratz] #432794
11/15/13 14:56
11/15/13 14:56
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
soooooo .... grin laugh

der schuss musste auch noch ne collision mit dem feind haben

Code:
function shoot_1_event()
{
 
 shoot_1(i);
  wait(35);
 i++;	
}

function shoot_1(i)
{ 
 //if(shoot_var == 1)		
 //{
 // shoot_var = 0;	
 
 
   
  snd_play(laser, 90, 0); 

  _shoot[i] = pan_create("bmap = shot.bmp;",5);
  _shoot[i].pos_x = _ship.pos_x+30  - bullet_width / 2;
  _shoot[i].pos_y = _ship.pos_y-20;  
  _shoot[i].flags |= VISIBLE;
    
//  shoot_var = 1;	
  
  
  
 while(_shoot[i] != NULL)
 {
  if(_shoot[i].pos_y > 5)
  {
   _shoot[i].pos_y -= 1;	      
  }
  else
  {
   reset(_shoot[i],VISIBLE); 
   break;
  }   

  if ((((_shoot[i].pos_x + bullet_width >= enemies[i_2].pos_x) && (_shoot[i].pos_x + bullet_width <= enemies[i_2].pos_x + enemy_width)) ||
			((enemies[i_2].pos_x + enemy_width >= _shoot[i].pos_x) && (enemies[i_2].pos_x + enemy_width <= _shoot[i].pos_x + bullet_width)))
			&& (((_shoot[i].pos_y + bullet_height >= enemies[i_2].pos_y) && (_shoot[i].pos_y + bullet_height <= enemies[i_2].pos_y + enemy_height)) ||
			((enemies[i_2].pos_y + enemy_height >= _shoot[i].pos_y) && (enemies[i_2].pos_y + enemy_height <= _shoot[i].pos_y + bullet_height))))
   {
				score += 20; 
			   snd_play(explo, 90, 0); 
			     
				reset(_shoot[i], VISIBLE); 
				_shoot[i] = NULL; 
			    
				
				enemies[i_2].bmap = explo1_tga; 
				wait (6);
				enemies[i_2].bmap = explo2_tga;
				wait (6);
				enemies[i_2].bmap = explo3_tga;
				wait (6);
				enemies[i_2].bmap = explo4_tga;
				wait (6);
				
				reset(enemies[i_2], VISIBLE); 
				create_enemy(i_2);
   	
	}	
  
  wait(1);
 }
  _shoot[i] = NULL;	
 //} 
}



und bei create_enemy musste noch weiter gerechnet werden mit i_2++;

Code:
function create_enemy(i_2)
{
enemies[i_2] = pan_create("bmap = enemy2.bmp; flags = VISIBLE;", 20);
enemies[i_2].pos_x = random(650);
enemies[i_2].pos_y = random(350);
enemy_collisions(i_2);
i_2++; // hier !!
}




und noch nen paar sachen wie health bar , score , leben (zeigt noch die i var an tongue )


Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1