Exemplo n.º 1
0
int main(int argc, char *argv[])
{
	GList* list = NULL;
	json_t *root;

	SDL_Surface *optimized_surface = NULL;
	SDL_Surface *temp = NULL;
	Sound *bg_music = NULL;
	Sound *level_music = NULL;
	int done;
	const Uint8 *keys;
	char imagepath[512];

	game_initialize_system();
	SDL_ShowCursor(SDL_DISABLE);

	bg_music = sound_load_music("sounds/vanguard_bouncy.mp3");
	if(!bg_music)
	{
		slog("Could not load music\n");
	}
	
	level_music = sound_load_music("sounds/chippy_cloud_kid.mp3");
	if(!level_music)
	{
		slog("Could not load music\n");
	}
	Mix_VolumeMusic(5);

	if(temp)
	{
		optimized_surface = SDL_ConvertSurface( temp, graphics_surface->format, NULL );
		SDL_FreeSurface(temp);
		
	}

	SDL_Event e;
	done = 0;

	int lock = true;
	do
	{
		if(menu_flag)
		{
			menu_draw();
			if(lock == false)
			{
				Mix_HaltMusic();
				lock = true;
			}

			if(Mix_PlayingMusic() == 0)
			{
				Mix_PlayMusic(bg_music->music, -1);
			}
		}
		else
		{
			tilemap_render_tile();
			entity_draw_all();
			if(lock == true)
			{
				Mix_HaltMusic();
				lock = false;
			}

			if(Mix_PlayingMusic() == 0)
			{
				Mix_PlayMusic(level_music->music, -1);
			}
		}

		mouse_draw_self();

		graphics_next_frame();
		SDL_PumpEvents();

		entity_think_all();

		while(SDL_PollEvent(&e) != 0)
		{
			if(e.type == SDL_QUIT)
			{
				done = 1;
			}
			
			bool leftclick = false ;
			bool rightclick = false;
			if(e.type == SDL_MOUSEBUTTONDOWN)
			{
				if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT))
				{
					leftclick = true;
				}
				else if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT))
				{
					rightclick = true;
				}
			}

			if(leftclick == true)
			{
				if(menu_flag)
					menu_click();
				else
					tilemap_click();
			}
			else if(rightclick == true)
			{
				if(menu_flag)
					menu_click();
				else
					tilemap_remove_tile();
			}

			bool pressed = false;
			if(e.type == SDL_KEYDOWN)
			{
				if(!pressed)
				{
					if(make_flag)
					{
						keys = SDL_GetKeyboardState(NULL);
						if(keys[SDL_SCANCODE_W])
						{
							State state = UP;
							tilemap_m_click(state);
						}
						else if(keys[SDL_SCANCODE_A])
						{
							State state = LEFT;
							tilemap_m_click(state);
						}
						else if(keys[SDL_SCANCODE_S])
						{
							State state = DOWN;
							tilemap_m_click(state);
						}
						else if(keys[SDL_SCANCODE_D])
						{
							State state = RIGHT;
							tilemap_m_click(state);
						}

						if(keys[SDL_SCANCODE_T])
						{
							State state = UP;
							tilemap_c_click(state);
						}
						else if(keys[SDL_SCANCODE_F])
						{
							State state = LEFT;
							tilemap_c_click(state);
						}
						else if(keys[SDL_SCANCODE_G])
						{
							State state = DOWN;
							tilemap_c_click(state);
						}
						else if(keys[SDL_SCANCODE_H])
						{
							State state = RIGHT;
							tilemap_c_click(state);
						}
					}
				}
				pressed = true;
			}
			else if(e.type == SDL_KEYUP)
			{
				pressed = false;
			}
		}

		keys = SDL_GetKeyboardState(NULL);
		if(keys[SDL_SCANCODE_ESCAPE])
		{
			done = 1;
		}

		SDL_RenderPresent(graphics_renderer); // update the screen with any rendering performed since previous call

	} while(!done);

	exit(0);
	return 0;
}
Exemplo n.º 2
0
Arquivo: game.c Projeto: ljg6/MyGame2D
int levelTwo()
{
	

	moving = 0;
	SDL_RenderClear(gt_graphics_get_active_renderer());
	ResetBuffer();

	backOffset = ((int)camera.x+3200)%3200;
	offset = ((int)camera.x+1600)%1600;

	drawSprite(moonBack,0,vec2d(0,0),vec2d(1,1),0,gt_graphics_get_active_renderer());
	
	drawSprite(levelTwoBackTrees,0,vec2d(-backOffset,0),vec2d(1,1),0,gt_graphics_get_active_renderer());
    drawSprite(levelTwoFrontTrees,0,vec2d(-offset,0),vec2d(1,1),0,gt_graphics_get_active_renderer());
	drawSprite(levelTwoFloor,0,vec2d(-offset,0),vec2d(1,1),0,gt_graphics_get_active_renderer());
	
	drawSprite(levelTwoFrontTrees,0,vec2d(-offset+1600,0),vec2d(1,1),0,gt_graphics_get_active_renderer());
	drawSprite(levelTwoBackTrees,0,vec2d(-backOffset+1600,0),vec2d(1,1),0,gt_graphics_get_active_renderer());
	drawSprite(levelTwoFloor,0,vec2d(-offset+1600,0),vec2d(1,1),0,gt_graphics_get_active_renderer());

	



	entity_think_all();
	entity_touch_all();
	entity_update_all();
	entity_draw_all();
	if(player->position.x >= 300)
		{
			camera.x = player->position.x - 300;
			
		}
	if(player->position.x < 300)
		{
			camera.x = 0;
			
		}
	if(xDistance == 12000.00)
	{
		done = 1;
	}

	healthBar();
    NextFrame();
    SDL_PumpEvents();
	diff = (gt_graphics_now - gt_graphics_then);
	
	if(playerData.shotTimer>0)
	{
		playerData.shotTimer -= diff;
	}
    keys = SDL_GetKeyboardState(NULL);
    if(keys[SDL_SCANCODE_ESCAPE])
    {
        done = 1;
    }
	else if(keys[SDL_SCANCODE_W])
	{
		moving = 1;
		moveCharacter(DIR_UP,player);
		yDistance = player->position.y;
	}
	else if(keys[SDL_SCANCODE_A])
	{
		moving = 1;
		moveCharacter(DIR_LEFT,player);
		xDistance = player->position.x;
	}
	else if(keys[SDL_SCANCODE_D])
	{
		moving = 1;
		moveCharacter(DIR_RIGHT,player);
		xDistance = player->position.x;
		
	}
	else if(keys[SDL_SCANCODE_S])
	{
		moving = 1;
		moveCharacter(DIR_DOWN,player);
		yDistance = player->position.y;
	}
	else if(keys[SDL_SCANCODE_1])
	{
		fire_Pistol();
	}
	else if(keys[SDL_SCANCODE_2])
	{
		fire_Shotgun();
	}
	else if(keys[SDL_SCANCODE_3])
	{
		fire_Machinegun();
	}
	else if(keys[SDL_SCANCODE_4])
	{
		fire_Heavy_Machinegun();
	}
	else if(keys[SDL_SCANCODE_P])
	{
		saveState();
	}
	else if(keys[SDL_SCANCODE_O])
	{
		loadState();
	}
	if(moving == 0)
	{
		resetAnimation(player, 0);
	}


	
  
  return 0;
}
Exemplo n.º 3
0
/*notice the default arguments for main.  SDL expects main to look like that, so don't change it*/
int main(int argc, char *argv[])
{
  SDL_Surface *temp = NULL;
  int done;
  int tx = 0,ty = 0;
  int i;
  const Uint8 *keys;
  char imagepath[512];
  SDL_Rect srcRect={0,0,SCREEN_WIDTH,SCREEN_HEIGHT};
  SDL_Event e;
  last_time = current_time = SDL_GetTicks();
  
  Init_All();
  slog("Finished Init All()");
  done = 0;
  do
  {
	   //render or draw functions go here
	//draw functions should go in order from background first to player draw calls last
    ResetBuffer();
    SDL_RenderClear(__gt_graphics_renderer);//clear screen
	tile_render();	
	player_draw();
	DrawMouse2();
	
	/*monster_spawn(Monster::grue);
	monster_spawn(Monster::spider01);
	monster_spawn(Monster::mino);		
	monster_spawn(Monster::orc);	
	support_spawn(Support::sara);	
	support_spawn(Support::healer);	
	support_spawn(Support::archer);
	
	*/
	entity_update_all();
	entity_think_all();
	entity_check_collision_all();
	particle_em_draw_all();
//	struct_update_all();
	

	G_MONSTER_SPAWN_TIMER -= 1;

	while(SDL_PollEvent(&e) != 0)
		player_move (&e);
    NextFrame();
	//end
    SDL_PumpEvents();
    keys = SDL_GetKeyboardState(NULL);
	//taken from lazyfoo
	//handles generally keyboard inputs	
	
	while( SDL_PollEvent( &e) != 0){
		if(e.type == SDL_QUIT)
			done = 1;
    	else
			player_move(&e);	
	}

		if(keys[SDL_SCANCODE_ESCAPE])
		{
			done = 1;
		}
		
	SDL_RenderPresent(__gt_graphics_renderer);
	last_time = current_time;
	current_time = SDL_GetTicks();
	delta = current_time - last_time;
  }while(!done);
  exit(0);		/*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/
  return 0;
}
Exemplo n.º 4
0
int main(int argc, char *argv[])
{
    int i;
    float r = 0;
	int f = -15;
	int g = 0;
	int l = 0;
	int y = 0;
	int u = 15;
	int q = 0;
	int gamestate=0;
	int PlayerHP=15, Bosshealth=30, enemy1health=5, enemy2health=5, Bigtimer=600, CD;
	int SpawnLemon1=0, SpawnLemon2=0, SpawnLemon3=0, SpawnBigLemon=0, enemybullet=0;
	float Lemonx1=0, Lemonx2=0, Lemonx3=0, LemonxBig=0, enemybulletx=0;
	int Lemony1=0, Lemony2=0, Lemony3=0, LemonyBig=0, enemybullety=0;
	int a=0, b=0, c=0, d=0, count, Goomba_attack1=0, Goomba_attack2=0, Goomba_move1, Goomba_move2;
    Space *space;
    Entity *cube1,*cube2, *Actor;
    char bGameLoopRunning = 1;
	Vec3D Bosspos = {u, y, 2};
	Vec3D enemy1pos = {5, 10, 2};
	Vec3D enemy2pos = {5, -10, 2};
    Vec3D cameraPosition = {0,0,70.3};
    Vec3D cameraRotation = {0,0,360};
    SDL_Event e;
    Obj *megaman,*boss, *mapp, *mape, *lemon, *BossHPBar, *PlayerHPBar, *Goomba;
    Sprite *megamantexture, *bosstexture, *maptexture1, *maptexture2, *lemontexture, *BosstextureHP, *PlayertextureHP, *Goombatexture;
    
    init_logger("gametest3d.log");
    if (graphics3d_init(1024,768,1,"gametest3d",33) != 0)
    {
        return -1;
    }
    model_init();
    obj_init();
    entity_init(255);
    
   //load objects, models here, replace cube with megaman
    megaman = obj_load("models/MPU.obj");
	//load his uv map "texture file"
    megamantexture = LoadSprite("models/MegaManBody1.png",1024,1024);

	PlayerHPBar = obj_load("models/cube.obj");
	PlayertextureHP = NULL;


	boss = obj_load("models/Fireman.obj");
	bosstexture = LoadSprite("models/FireManBody1.png",1024,1024);

	BossHPBar = obj_load("models/cube.obj");
	BosstextureHP = NULL;

	Goomba = obj_load("models/goomba.obj");
	Goombatexture = LoadSprite("models/goomba_tex.png",1024,1024);

    mapp = obj_load("models/MidtermMapSingle.obj");
	maptexture1 = LoadSprite("models/PlayerTile(Red).png",1024,1024);

	mape = obj_load("models/MidtermMapSingle.obj");
	maptexture2 = LoadSprite("models/BossTile(Blue).png",1024,1024);
    
    lemon = obj_load("models/cube.obj");
	lemontexture = NULL;//LoadSprite("models/cube_text.png",1024,1024);
    
	    
    while (bGameLoopRunning)
    {
        entity_think_all();

        while ( SDL_PollEvent(&e) ) 
        {
            if (e.type == SDL_QUIT)
            {
                bGameLoopRunning = 0;
            }
            else if (e.type == SDL_KEYDOWN)
            {
                if (e.key.keysym.sym == SDLK_ESCAPE)
                {
                    bGameLoopRunning = 0;
                }
                else if (e.key.keysym.sym == SDLK_x)
                {
                    cameraPosition.z++;
                }
                else if (e.key.keysym.sym == SDLK_z)
                {
                    cameraPosition.z--;
                }
                else if (e.key.keysym.sym == SDLK_h)
                {
                    vec3d_add(
                        cameraPosition,
                        cameraPosition,
                        vec3d(
                            -sin(cameraRotation.z * DEGTORAD),
                            cos(cameraRotation.z * DEGTORAD),
                            0
                        ));
                }
                else if (e.key.keysym.sym == SDLK_y)
                {
                    vec3d_add(
                        cameraPosition,
                        cameraPosition,
                        vec3d(
                            sin(cameraRotation.z * DEGTORAD),
                            -cos(cameraRotation.z * DEGTORAD),
                            0
                        ));
                }
                else if (e.key.keysym.sym == SDLK_j)
                {
                    vec3d_add(
                        cameraPosition,
                        cameraPosition,
                        vec3d(
                            cos(cameraRotation.z * DEGTORAD),
                            sin(cameraRotation.z * DEGTORAD),
                            0
                        ));
                }
                else if (e.key.keysym.sym == SDLK_g)
                {
                    vec3d_add(
                        cameraPosition,
                        cameraPosition,
                        vec3d(
                            -cos(cameraRotation.z * DEGTORAD),
                            -sin(cameraRotation.z * DEGTORAD),
                            0
                        ));
                }
				else if (e.key.keysym.sym == SDLK_d)
                {
                   
				   
				   if(f >= -5)
				   {
					   f = -5;
				   }
				   else
				   {
					   f += 10;
				   }
                }
				else if (e.key.keysym.sym == SDLK_a)
                {
                   
				   
				   if(f <= -20)
				   {
					   f = -25;
				   }
				   else
				   {
					   f -= 10;
				   }
				  			
                }
				else if (e.key.keysym.sym == SDLK_w)
                {
                   
				   if(g >= 5)
				   {
					   g = 10;
				   }
				   else
				   {
					   g += 10;
				   }
			
                }
				else if (e.key.keysym.sym == SDLK_s)
                {
                   
				   g -= 10;
				    if(g <= -5)
				   {
					   g = -10;
				   }
			
                }
                else if (e.key.keysym.sym == SDLK_LEFT)
                {
                    cameraRotation.z += 1;
                }
                else if (e.key.keysym.sym == SDLK_RIGHT)
                {
                    cameraRotation.z -= 1;
                }
                else if (e.key.keysym.sym == SDLK_UP)
                {
                    cameraRotation.x += 1;
                }
                else if (e.key.keysym.sym == SDLK_DOWN)
                {
                    cameraRotation.x -= 1;
                }
                else if (e.key.keysym.sym == SDLK_SPACE)
                {
                    
					CD = TIME + Bigtimer;					
					
                }
				else if (e.key.keysym.sym == SDLK_n)
                {
                   
				   if (enemy1health <= 0 && enemy2health <= 0)
				   {
					   gamestate=1;
				   }
			
                }
				else if (e.key.keysym.sym == SDLK_n)
                {
                   
				   if (enemy1health <= 0 && enemy2health <= 0)
				   {
					   gamestate=1;
				   }
			
                }
            }
			else if (e.type == SDL_KEYUP)
			{
				if (e.key.keysym.sym == SDLK_SPACE)
				{
					
					if (TIME >= CD && SpawnBigLemon !=1)
					{
						SpawnBigLemon = 1;
						LemonxBig = f;
						LemonyBig = g;
					}
					else if (SpawnLemon1 != 1)
					{
						SpawnLemon1 = 1;
						Lemonx1 = f;
						Lemony1 = g;
					}
					else if (SpawnLemon2 != 1)
					{
						SpawnLemon2 = 1;
						Lemonx2 = f;
						Lemony2 = g;
					}
					else if (SpawnLemon3 != 1)
					{
						SpawnLemon3 = 1;
						Lemonx3 = f;
						Lemony3 = g;
					}
					
				}
			}
				
        }

                
        graphics3d_frame_begin();
        
        glPushMatrix();
        set_camera(
            cameraPosition,
            cameraRotation);
        
        //entity_draw_all();
      
		if (PlayerHP > 0 )
		{
		//Megaman
        obj_draw(
            megaman,
            vec3d(f, g, 2),
            vec3d(90,90,0),
            vec3d(0.5,0.5,0.5),
            vec4d(1,1,1,1),
            megamantexture
        );

		//Megaman HP BAR
		obj_draw(
            PlayerHPBar,
            vec3d(-30+PlayerHP/(2),20,2),
            vec3d(90,-90,0),
            vec3d(.9,.9,PlayerHP/(2)),
            vec4d(0,1,0,1),
			PlayertextureHP
        );
		}

		//Megaman Projectiles
		//Lemon1
		if (SpawnLemon1 != 0)
		{
			obj_draw(
			lemon,
            vec3d(Lemonx1 + a*(.4), Lemony1, 4),
            vec3d(90,90,0),
            vec3d(1,1,2),
            vec4d(.95,.89,0,1),
		    lemontexture
		);
			a++;
				if (Lemonx1 + a*(.4) >=30)
				{
					SpawnLemon1 = 0;
					a=0;
				}
				else if (Lemonx1 + a*(.4) == enemy1pos.x && Lemony1 == enemy1pos.y)
				{
					SpawnLemon1 = 0;
					a=0;
					enemy1health -= 1;
					//slog("Enemy Health %d",enemy1health);
				}
				else if (Lemonx1 + a*(.4) == enemy2pos.x && Lemony1 == enemy2pos.y)
				{
					SpawnLemon1 = 0;
					a=0;
					enemy2health -= 1;
					//slog("Enemy Health %d",enemy2health);
				}
				else if (gamestate == 1 && Lemonx1 + a*(.4) == Bosspos.x && Lemony1 == Bosspos.y)
				{
				SpawnLemon1 = 0;
				a=0;
				Bosshealth -= 1;
				//slog("Boss Health %d",Bosshealth);
				}
		}
		//Lemon2
		if (SpawnLemon2 != 0)
		{
			obj_draw(
			lemon,
            vec3d(Lemonx2 + b*(.4), Lemony2, 4),
            vec3d(90,90,0),
            vec3d(1,1,2),
            vec4d(.95,.89,0,1),
		    lemontexture
		);
			b++;
				if (Lemonx2 + b*(.4) >=30)
				{
					SpawnLemon2 = 0;
					b=0;
				}
				else if (Lemonx2 + b*(.4) == enemy1pos.x && Lemony2 == enemy1pos.y)
				{
					SpawnLemon2 = 0;
					b=0;
					enemy1health -= 1;
					//slog("Enemy Health %d",enemy1health);
				}
				else if (Lemonx2 + b*(.4) == enemy2pos.x && Lemony2 == enemy2pos.y)
				{
					SpawnLemon2 = 0;
					b=0;
					enemy2health -= 1;
					//slog("Enemy Health %d",enemy2health);
				}
				else if (gamestate == 1 && Lemonx2 + b*(.4) == Bosspos.x && Lemony2 == Bosspos.y)
				{
					SpawnLemon2 = 0;
					b=0;
					Bosshealth -= 1;
					//slog("Boss Health %d",Bosshealth);
				}
		}
		if (SpawnLemon3 != 0)
		{
			obj_draw(
			lemon,
            vec3d(Lemonx3 + c*(.4), Lemony3, 4),
            vec3d(90,90,0),
            vec3d(1,1,2),
            vec4d(.95,.89,0,1),
		    lemontexture
		);
			c++;
				//lemons fly off staege
				if (Lemonx3 + c*(.4) >=30)
				{
					SpawnLemon3 = 0;
					c=0;
				}
				//lemons collide with enemies
				else if (Lemonx3 + c*(.4) == enemy1pos.x && Lemony3 == enemy1pos.y)
				{
					SpawnLemon3 = 0;
					c=0;
					enemy1health -= 1;
					slog("Enemy Health %d",enemy1health);
				}
				else if (Lemonx3 + c*(.4) == enemy2pos.x && Lemony3 == enemy2pos.y)
				{
					SpawnLemon3 = 0;
					c=0;
					enemy2health -= 1;
					slog("Enemy Health %d",enemy2health);
				}
				else if (gamestate == 1 && Lemonx3 + c*(.4) == Bosspos.x && Lemony3 == Bosspos.y)
				{
					SpawnLemon3 = 0;
					c=0;
					Bosshealth -= 1;
					//slog("Boss Health %d",Bosshealth);
				}
		}
		if (SpawnBigLemon != 0)
		{
			obj_draw(
			lemon,
            vec3d(LemonxBig + d*(.4), LemonyBig, 4),
            vec3d(90,90,0),
            vec3d(2,2,4),
            vec4d(.9,.3,.1,1),
		    lemontexture
		);
			d++;
				if (LemonxBig + d*(.4) >=30)
				{
					SpawnBigLemon = 0;
					d=0;
				}
				else if (LemonxBig + d*(.4) == enemy1pos.x && LemonyBig == enemy1pos.y)
				{
					SpawnBigLemon = 0;
					d=0;
					enemy1health -= 5;
					//slog("Enemy Health %d",enemy1health);
				}
				else if (LemonxBig + d*(.4) == enemy2pos.x && LemonyBig == enemy2pos.y)
				{
					SpawnBigLemon = 0;
					d=0;
					enemy2health -= 5;
					//slog("Enemy Health %d",enemy2health);
				}
				else if (gamestate == 1 && LemonxBig + d*(.4) == Bosspos.x && LemonyBig == Bosspos.y)
				{
					SpawnBigLemon = 0;
					d=0;
					Bosshealth -= 5;
					slog("Boss Health %d",Bosshealth);
				}
		}

		
		//MAP
		obj_draw(
            mapp,
            vec3d(-15,0,2),
            vec3d(90,90,0),
            vec3d(5,5,5),
            vec4d(1,1,1,1),
		    maptexture1
		);
		obj_draw(
            mape,
            vec3d(15,0,2),
            vec3d(90,90,0),
            vec3d(5,5,5),
            vec4d(1,1,1,1),
		    maptexture2
		);
		

		//Enemies
		if (gamestate == 0)
		{

			if (enemy1health > 0)
			{
			//enemy_move(enemypos.x,enemypos.y, &enemypos);
			//enemy_attack1(Goomba_attack1, &enemy1pos);

			obj_draw(
            Goomba,
            vec3d(enemy1pos.x,enemy1pos.y,2),
            vec3d(90,-90,0),
            vec3d(0.1,0.1,0.1),
            vec4d(1,1,1,1),
            Goombatexture
			);
						
			if (Goomba_attack1 == 0)
			{
				Goomba_attack1 = rand_ranged( 1, 5); //start to (end - 1)
				if (Goomba_attack1 == 2)
				{
					Goomba_attack1 = 1;
				}
		
			};

			if (Goomba_attack1 == 1)
			{
				enemy1pos.x -=.1;
				if (enemy1pos.x <= -30)
				{
					Goomba_attack1 = 0;
					enemy1pos.x = 5;
				}
			}

			}
			else
			{
				enemy1pos.x = 50;
				enemy1pos.y = 50;
			}

			if (enemy2health > 0)
			{
			//enemy_move(enemypos.x,enemypos.y, &enemypos);
			//enemy_attack2(Goomba_attack2, &enemy2pos);
			obj_draw(
            Goomba,
            vec3d(enemy2pos.x,enemy2pos.y,2),
            vec3d(90,-90,0),
            vec3d(0.1,0.1,0.1),
            vec4d(1,1,1,1),
            Goombatexture
			);

			//bottom Goomba won't attack

			if (Goomba_attack2 == 0)
			{
				Goomba_attack2 = rand_ranged( 1, 5); //start to (end - 1)
				if (Goomba_attack2 == 2)
				{
					Goomba_attack2 = 1;
				}
		
			};

			if (Goomba_attack2 == 1)
			{
				enemy2pos.x -=.1;
				if (enemy2pos.x <= -30)
				{
					Goomba_attack2 = 0;
					enemy2pos.x = 5;
				}
			}

			
			}
			else
			{
				enemy2pos.x = 50;
				enemy2pos.y = 50;
			}
			
		}
		if (gamestate != 0)
		{
		if (Bosshealth > 0)
		{
			Boss_move(Bosspos.x,Bosspos.y, &Bosspos);      	    
			//Fire man
			obj_draw(
				boss,
				vec3d(Bosspos.x,Bosspos.y,2),
				vec3d(90,-90,0),
				vec3d(0.5,0.5,0.5),
				vec4d(1,1,1,1),
				bosstexture
				);

				obj_draw(
				BossHPBar,
				vec3d(30-Bosshealth/(2.5),20,2),
				vec3d(90,-90,0),
				vec3d(.9,.9,Bosshealth/(2.5)),
				vec4d(1,0,0,1),
				BosstextureHP
			);

		}
		else
		{
			obj_free(boss);

			Bosspos.x = 50;
			Bosspos.y = 50;
			slog("You WIN!");
		}
		

		}
        
        if (r > 360)r -= 360;
        glPopMatrix();
        /* drawing code above here! */
        graphics3d_next_frame();
	} 
	return 0;
	}