Hi there!
I'm recently new to java and i have two questions for u guys.
I'm creating a game in which we have one polygon (our 'ship') and two monsters. Both of the monsters and the ship are triangles like my code show down below
First i would like to ask how can i put the monsters moving randomly through the screen (There are no borders, example, if one monster hits the top it appears on the bot going top).Code:void buildmonster(){
m_monster = new Polygon();
m_monster.addPoint(10,0);
m_monster.addPoint(-10,10);
m_monster.addPoint(-10,-10);
m_monster.addPoint(10,0); /* fecha o ciclo */
m_monster_angle = 0;
spawnarmonster();
m_monster_speed = 0;
/**
* constroi o norris
*/
void buildnorris(){
m_norris = new Polygon();
m_norris.addPoint(10,0);
m_norris.addPoint(-5,5);
m_norris.addPoint(-5,-5);
m_norris.addPoint(10,0);
m_norris_angle = 0;
spawnarnorris();
m_norris_speed = 0;
m_norris_max_forward_speed = param_norris_max_forward_speed;
m_norris_max_back_speed = param_norris_max_back_speed;
m_norris_acceleration_speed =param_norris_acceleration_speed;
m_norris_turn_speed = param_norris_turn_speed;
}
Last i would like to know what's the way to detect the collision between the ship and the monster and
- if the ship hits the monster back, destroys them
- if not it destroys the ship (in my game loses 1 up)
Thanks
