Beispiel #1
0
/* Set_Data()
 *==========================================================================
 * Set keyclick, bell, double-click speed, keyboard response and repeat
 * and blitter/ttcache.
 */
void
Set_Data()
{
   Set_Keybell();
   Set_Dclick();
   Set_Kbrate();
   Set_Speed();
   Set_Block2();
}
Beispiel #2
0
void cRokko :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
	// position
	Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 );
	// direction
	Set_Direction( Get_Direction_Id( attributes.getValueAsString( "direction", Get_Direction_Name( m_start_direction ) ).c_str() ) );
	// speed
	Set_Speed( attributes.getValueAsFloat( "speed", m_speed ) );
}
Beispiel #3
0
bool cRokko::Editor_Speed_Text_Changed(const CEGUI::EventArgs& event)
{
    const CEGUI::WindowEventArgs& windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>(event);
    std::string str_text = static_cast<CEGUI::Editbox*>(windowEventArgs.window)->getText().c_str();

    Set_Speed(string_to_float(str_text));

    return 1;
}
Beispiel #4
0
void cStaticEnemy :: Init( void )
{
	m_type = TYPE_STATIC_ENEMY;
	m_pos_z = 0.094f;
	m_can_be_on_ground = 0;
	m_can_be_hit_from_shell = 0;

	m_path_state = cPath_State();
	Set_Rotation_Speed( 0.0f );
    Set_Speed( 0.0f );
	Set_Static_Image( "enemy/static/blocks/spike_1/2_grey.png" );
	Create_Name();
}
Beispiel #5
0
cRokko::cRokko(XmlAttributes& attributes, cSprite_Manager* sprite_manager)
    : cEnemy(sprite_manager)
{
    cRokko::Init();

    // position
    Set_Pos(string_to_float(attributes["posx"]), string_to_float(attributes["posy"]), true);

    // direction
    Set_Direction(Get_Direction_Id(attributes.fetch("direction", Get_Direction_Name(m_start_direction))));

    // speed
    Set_Speed(string_to_float(attributes.fetch("speed", float_to_string(m_speed))));
}
Beispiel #6
0
void cStaticEnemy :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
	// position
	Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 );
	// rotation speed
	Set_Rotation_Speed( static_cast<float>( attributes.getValueAsFloat( "rotation_speed", -7.5f ) ) );
	// image
	Set_Static_Image( attributes.getValueAsString( "image", "enemy/static/saw/default.png" ).c_str() );
    // path
    Set_Path_Identifier( attributes.getValueAsString( "path", "" ).c_str() );
    // movement speed
    Set_Speed( static_cast<float>( attributes.getValueAsFloat( "speed", m_speed ) ) );
	// fire resistant
	m_fire_resistant = attributes.getValueAsBool( "fire_resistant", m_fire_resistant );
	// ice resistance
	m_ice_resistance = static_cast<float>( attributes.getValueAsFloat( "ice_resistance", m_ice_resistance ) );
}
Beispiel #7
0
cFlyon::cFlyon(XmlAttributes& attributes, cSprite_Manager* sprite_manager)
    : cEnemy(sprite_manager)
{
    cFlyon::Init();

    // position
    Set_Pos(string_to_float(attributes["posx"]), string_to_float(attributes["posy"]), true);

    // image directory
    Set_Image_Dir(utf8_to_path(attributes.fetch("image_dir", path_to_utf8(m_img_dir))));

    // direction
    Set_Direction(Get_Direction_Id(attributes.fetch("direction", Get_Direction_Name(m_start_direction))));

    // max distance
    Set_Max_Distance(string_to_int(attributes.fetch("max_distance", int_to_string(m_max_distance))));

    // speed
    Set_Speed(string_to_float(attributes.fetch("speed", float_to_string(m_speed))));
}
Beispiel #8
0
void cRokko::Init(void)
{
    m_type = TYPE_ROKKO;
    m_name = "Rokko";
    m_massive_type = MASS_PASSIVE;
    m_pos_z = 0.03f;
    m_gravity_max = 0;
    m_editor_pos_z = 0.09f;
    m_can_be_on_ground = 0;
    m_camera_range = 4000;
    Set_Rotation_Affects_Rect(1);
    Set_Active(0);

    m_fire_resistant = 1;
    m_ice_resistance = 1;
    m_can_be_hit_from_shell = 0;

    Set_Direction(DIR_LEFT);
    Set_Speed(8.5f);
    m_min_distance_front = 200;
    Set_Max_Distance_Front(1000);
    Set_Max_Distance_Sides(400);
    m_state = STA_STAY;
    m_manual = false;

    m_smoke_counter = 0;

    m_kill_sound = "enemy/rokko/hit.wav";
    m_kill_points = 250;

    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/fly_1.png"));
    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/fly_2.png"));
    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/fly_3.png"));
    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/break_1.png"));
    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/break_2.png"));
    Add_Image(pVideo->Get_Surface("enemy/rokko/yellow/break_3.png"));
    Set_Image_Num(0, true);
    Set_Animation(true);
    Set_Animation_Image_Range(0, 2);
    Set_Time_All(130, true);
}
Beispiel #9
0
void cFlyon::Init(void)
{
    m_type = TYPE_FLYON;
    m_name = "Flyon";
    m_pos_z = 0.06f;
    Set_Rotation_Affects_Rect(1);
    m_editor_pos_z = 0.089f;
    m_camera_range = 1000;
    m_can_be_on_ground = 0;
    m_can_be_ground = 0;

    m_state = STA_STAY;
    Set_Direction(DIR_UP);
    Set_Image_Dir(utf8_to_path("enemy/flyon/orange/"));
    Set_Max_Distance(200);
    Set_Speed(5.8f);

    m_kill_sound = "enemy/flyon/die.ogg";
    m_kill_points = 100;

    m_wait_time = Get_Random_Float(0.0f, 70.0f);
    m_move_back = 0;
}
Beispiel #10
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f10x_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f10x.c file
     */ 
	LED_Configuration();
	SysTick_Configuration();
	USART_Configuration();
	Buzzer_Configuration();
	LED_Interrupt();//¿ªÆô¶¨Ê±Æ÷ÖжÏ
	PWM_Configuration();

	LED_Set(0x00);
  /* Infinite loop */
  while (1)										 
  {
// 	Set_Speed(1,50,0);
//	Set_Speed(2,50,0);
//	Buzzer_ON();
//	delay_ms(1000);
//	Set_Speed(1,50,1);
//	Set_Speed(2,50,1);
//	Buzzer_ON();
//	delay_ms(1000);
	switch(instruction)
	{
		case 'a': 
			Set_Speed(1,50,1);
			Set_Speed(2,50,1);
			break;
		case 'b': 
			Set_Speed(1,50,1);
			Set_Speed(2,50,0);
			break;	
		case 'c': 
			Set_Speed(1,50,0);
			Set_Speed(2,50,1);
			break;
		case 'd': 
			Set_Speed(1,50,0);
			Set_Speed(2,50,0);
			break;
		case 's': 
			Set_Speed(1,0,0);
			Set_Speed(2,0,0);
			break;
		case 'z':
				Buzzer_ON();
				break;
		case 'y':
				Buzzer_OFF();
				break;
		 default: break;
										
	}


  }
}
Beispiel #11
0
 void cStaticEnemy::Create_From_Stream(XMLElement* attributes)
 {
     int _posx, _posy;
     float _rotation_speed = -7.5f;
     std::string _image = "enemy/static/saw/default.png";
     std::string _path = "";
     float _speed = m_speed;
     bool _fire_resistant = m_fire_resistant;
     float _ice_resistance = m_ice_resistance;
     
     for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement())
     {
         const char* name = node->Attribute("name");
         const char* value = node->Attribute("value");
         
         if (!strcmp(name, "posx"))
         {
             _posx = atoi(value);
         }
         else if (!strcmp(name, "posy"))
         {
             _posy = atoi(value);
         }
         else if (!strcmp(name, "rotation_speed"))
         {
             _rotation_speed = atof(value);
         }
         else if (!strcmp(name, "image"))
         {
             _image = value;
         }
         else if (!strcmp(name, "path"))
         {
             _path = value;
         }
         else if (!strcmp(name, "speed"))
         {
             _speed = atof(value);
         }
         else if (!strcmp(name, "fire_resistatnt"))
         {
             if (value[0] == '0')
             {
                 _fire_resistant = false;
             }
             else if (value[0] == '1')
             {
                 _fire_resistant = true;
             }
         }
         else if (!strcmp(name, "ice_resistance"))
         {
             _ice_resistance = atof(value);
         }
     }
     
     Set_Pos(static_cast<float>(_posx), static_cast<float>(_posy), 1);
     Set_Rotation_Speed(static_cast<float>(_rotation_speed));
     Set_Static_Image(_image.c_str());
     Set_Path_Identifier(_path.c_str());
     Set_Speed(static_cast<float>(_speed));
     m_fire_resistant = _fire_resistant;
     m_ice_resistance = _ice_resistance;
 }