spaceinator/objects/obj_player.object.gmx

489 lines
11 KiB
XML

<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>spr_player</spriteName>
<solid>0</solid>
<visible>-1</visible>
<depth>-100</depth>
<persistent>0</persistent>
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
<events>
<event eventtype="0" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// Player creation code.
ship_type = 0;
image_speed = 0;
image_index = ship_type;
is_moving = false;
dead = false;
invuln_counter_max = 1*room_speed;
invuln_counter = invuln_counter_max;
energy_max = 500;
energy = energy_max
// set hp to 100
hp_max = 100;
hp = hp_max;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="3" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// Player per frame
if(dead == true)
{
gravity = 0;
speed = 0;
direction = 0;
return 0;
}
if(hp &lt;= 0 &amp;&amp; !dead)
{
speed = 0;
direction = 0;
instance_create(x,y,obj_boom_fx);
sprite_index = spr_boom;
image_speed = 1;
dead = true;
}
direction = image_angle
speed = floor(speed);
if(speed &lt; 0)
{
speed += 1;
}
if(speed &gt; 0)
{
speed -= 1
}
if((energy &gt;= 10 &amp;&amp; is_moving &amp;&amp; keyboard_check(vk_shift)) || (energy &gt;= 10 &amp;&amp; is_moving &amp;&amp; gamepad_button_check(0,gp_face3)))
{
if(speed &gt; 30)
{
speed = 30;
}
energy -= 10;
}
else
{
if(speed &gt; 20)
{
speed = 20;
}
}
view_xview[0] = x - view_wview[0]/2;
view_yview[0] = y - view_hview[0]/2;
if(!is_moving)
{
if(energy &lt; energy_max)
{
energy += 5;
}
}
if(invuln_counter == invuln_counter_max)
{
visible = true;;
}
if(invuln_counter != invuln_counter_max)
{
if(invuln_counter % 5 == 0)
{
visible = !visible;
}
invuln_counter ++;
}
</string>
</argument>
</arguments>
</action>
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>///pull_towards_black_holes();
pull_towards_black_holes();
</string>
</argument>
</arguments>
</action>
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// Do Controller Stuff
if(keyboard_check(ord("A")) || gamepad_button_check(0,gp_padl))
{
if(dead == true)
{
return 0;
}
image_angle += 5;
}
if(keyboard_check(ord("D")) || gamepad_button_check(0,gp_padr))
{
if(dead == true)
{
return 0;
}
image_angle -= 5;
}
if(keyboard_check_pressed(ord("W")) || gamepad_button_check_pressed(0,gp_padu))
{
if(dead == true)
{
return 0;
}
is_moving = true;
audio_play_sound(snd_engine,1,true);
image_index = ship_type+1;
}
if(keyboard_check(ord("W")) || gamepad_button_check(0,gp_padu))
{
if(dead == true || speed &lt; 0)
{
return 0;
}
direction = image_angle
speed += 5
}
if(keyboard_check_released(ord("W")) || gamepad_button_check_released(0,gp_padu))
{
if(dead == true)
{
return 0;
}
is_moving = false;
audio_stop_sound(snd_engine)
image_index = ship_type;
}
if((mouse_check_button_pressed(mb_left) &amp;&amp; os_type != os_psvita) || gamepad_button_check_pressed(0,gp_shoulderr))
{
if(dead == true)
{
return 0;
}
if(obj_inv_controller.is_open)
{
return 0;
}
if(energy &gt;= 20)
{
var new_bullet = instance_create(x,y,obj_bullet);
audio_play_sound(snd_shoot,2,false);
new_bullet.image_angle = image_angle;
new_bullet.direction = image_angle;
new_bullet.speed = speed + 5;
energy -= 20;
}
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="obj_placed_item">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>damage_player(5);
instance_create(other.x,other.y,obj_boom_fx);
speed = -20;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="obj_dropped_item">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>var didAdd = add_item_to_inventory(other.item_id);
if(didAdd)
{
instance_destroy(other);
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="obj_black_hole">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>damage_player(hp_max);
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="obj_broken_ship">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>damage_player(5);
instance_create(other.x,other.y,obj_boom_fx);
other.direction = direction;
other.image_angle = image_angle;
other.speed = 20;
speed = -20;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="4" ename="obj_asteriod">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>damage_player(5);
instance_create(other.x,other.y,obj_boom_fx);
other.direction = direction;
other.image_angle = image_angle;
other.speed = 20;
speed = -20;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="7" enumb="7">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// Show Game over screen
if(dead == false)
{
return 0;
}
visible = false;
obj_controller.visible = false;
image_speed = 0;
instance_create(view_xview[0]+(view_wview[0]/2),view_yview[0]+(view_hview[0]/2),obj_gameover_overlay);
instance_create(view_xview[0]+(view_wview[0]/2),view_yview[0]+(view_hview[0]/2),obj_respawn);
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="9" enumb="123">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>if(global.debug)
{
ship_type +=2;
image_index = ship_type;
}
</string>
</argument>
</arguments>
</action>
</event>
</events>
<PhysicsObject>0</PhysicsObject>
<PhysicsObjectSensor>0</PhysicsObjectSensor>
<PhysicsObjectShape>0</PhysicsObjectShape>
<PhysicsObjectDensity>0.5</PhysicsObjectDensity>
<PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
<PhysicsObjectGroup>0</PhysicsObjectGroup>
<PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
<PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
<PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
<PhysicsObjectAwake>-1</PhysicsObjectAwake>
<PhysicsObjectKinematic>0</PhysicsObjectKinematic>
<PhysicsShapePoints/>
</object>