spaceinator/objects/obj_player.object.gmx

489 lines
11 KiB
Plaintext
Raw Permalink Normal View History

2020-07-22 01:56:09 +00:00
<!--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>
2020-07-24 08:17:51 +00:00
<depth>-100</depth>
2020-07-22 01:56:09 +00:00
<persistent>0</persistent>
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
<events>
2020-07-22 03:26:19 +00:00
<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>
2020-07-23 20:57:47 +00:00
<string>/// Player creation code.
2020-07-25 08:40:52 +00:00
ship_type = 0;
2020-07-23 20:57:47 +00:00
image_speed = 0;
2020-07-25 08:40:52 +00:00
image_index = ship_type;
2020-07-24 12:24:30 +00:00
is_moving = false;
dead = false;
invuln_counter_max = 1*room_speed;
invuln_counter = invuln_counter_max;
2020-07-23 20:57:47 +00:00
2020-07-26 22:39:19 +00:00
2020-07-24 12:24:30 +00:00
energy_max = 500;
energy = energy_max
2020-09-10 01:11:24 +00:00
// set hp to 100
2020-07-24 12:24:30 +00:00
hp_max = 100;
hp = hp_max;
2020-07-22 03:26:19 +00:00
</string>
</argument>
</arguments>
</action>
</event>
2020-07-22 02:47:12 +00:00
<event eventtype="3" enumb="0">
2020-07-22 02:24:30 +00:00
<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>
2020-07-23 20:57:47 +00:00
<string>/// Player per frame
2020-07-24 12:24:30 +00:00
if(dead == true)
{
2020-07-25 08:10:48 +00:00
gravity = 0;
speed = 0;
direction = 0;
2020-07-24 12:24:30 +00:00
return 0;
}
2020-07-25 08:10:48 +00:00
if(hp &lt;= 0 &amp;&amp; !dead)
2020-07-24 12:24:30 +00:00
{
speed = 0;
direction = 0;
2020-07-25 08:10:48 +00:00
instance_create(x,y,obj_boom_fx);
2020-07-24 12:24:30 +00:00
sprite_index = spr_boom;
image_speed = 1;
2020-07-25 08:10:48 +00:00
dead = true;
2020-07-24 12:24:30 +00:00
}
2020-07-23 20:57:47 +00:00
direction = image_angle
2020-07-25 07:47:36 +00:00
speed = floor(speed);
2020-07-24 12:24:30 +00:00
if(speed &lt; 0)
{
speed += 1;
}
2020-07-22 02:47:12 +00:00
if(speed &gt; 0)
2020-07-24 12:24:30 +00:00
{
2020-07-22 02:47:12 +00:00
speed -= 1
2020-07-24 12:24:30 +00:00
}
2020-09-08 23:53:46 +00:00
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)))
2020-07-24 12:24:30 +00:00
{
if(speed &gt; 30)
{
speed = 30;
}
energy -= 10;
}
else
{
if(speed &gt; 20)
{
speed = 20;
}
}
2020-07-22 02:47:12 +00:00
view_xview[0] = x - view_wview[0]/2;
view_yview[0] = y - view_hview[0]/2;
2020-07-23 20:57:47 +00:00
2020-07-24 12:24:30 +00:00
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 ++;
}
2020-07-25 07:47:36 +00:00
</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();
2020-07-29 01:22:35 +00:00
</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>
2020-08-09 22:13:19 +00:00
<string>/// Do Controller Stuff
2020-07-29 01:22:35 +00:00
2020-08-09 22:13:19 +00:00
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;
}
2020-07-29 01:22:35 +00:00
2020-08-09 22:13:19 +00:00
if((mouse_check_button_pressed(mb_left) &amp;&amp; os_type != os_psvita) || gamepad_button_check_pressed(0,gp_shoulderr))
2020-07-28 23:29:00 +00:00
{
2020-08-09 22:13:19 +00:00
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;
}
2020-07-28 23:29:00 +00:00
}
2020-08-09 22:13:19 +00:00
2020-09-08 23:53:46 +00:00
</string>
</argument>
</arguments>
</action>
</event>
2020-09-09 23:52:49 +00:00
<event eventtype="4" ename="obj_placed_item">
2020-09-08 23:53:46 +00:00
<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;
2020-07-25 07:47:36 +00:00
</string>
</argument>
</arguments>
</action>
</event>
2020-09-09 23:52:49 +00:00
<event eventtype="4" ename="obj_dropped_item">
2020-07-24 12:24:30 +00:00
<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>
2020-09-09 23:52:49 +00:00
<string>var didAdd = add_item_to_inventory(other.item_id);
if(didAdd)
{
instance_destroy(other);
}
2020-07-22 02:24:30 +00:00
</string>
</argument>
</arguments>
</action>
</event>
2020-09-09 23:52:49 +00:00
<event eventtype="4" ename="obj_black_hole">
2020-07-22 01:56:09 +00:00
<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>
2020-09-09 23:52:49 +00:00
<string>damage_player(hp_max);
2020-07-22 01:56:09 +00:00
</string>
</argument>
</arguments>
</action>
</event>
2020-09-09 23:52:49 +00:00
<event eventtype="4" ename="obj_broken_ship">
2020-07-22 01:56:09 +00:00
<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>
2020-09-09 23:52:49 +00:00
<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;
2020-07-22 01:56:09 +00:00
</string>
</argument>
</arguments>
</action>
</event>
2020-08-09 22:13:19 +00:00
<event eventtype="4" ename="obj_asteriod">
2020-07-22 02:24:30 +00:00
<action>
<libid>1</libid>
2020-07-22 02:47:12 +00:00
<id>603</id>
<kind>7</kind>
2020-07-22 02:24:30 +00:00
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
2020-07-22 02:47:12 +00:00
<exetype>2</exetype>
<functionname></functionname>
2020-07-22 02:24:30 +00:00
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
2020-07-22 02:47:12 +00:00
<kind>1</kind>
2020-08-09 22:13:19 +00:00
<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;
2020-07-24 12:24:30 +00:00
</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>
2020-07-25 06:03:40 +00:00
<string>/// Show Game over screen
if(dead == false)
2020-07-24 12:24:30 +00:00
{
return 0;
}
2020-07-25 08:10:48 +00:00
visible = false;
2020-07-24 12:24:30 +00:00
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);
2020-07-22 03:43:09 +00:00
2020-07-25 08:40:52 +00:00
</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;
2020-07-25 08:49:06 +00:00
image_index = ship_type;
2020-07-25 08:40:52 +00:00
}
2020-07-22 02:47:12 +00:00
</string>
2020-07-22 02:24:30 +00:00
</argument>
</arguments>
</action>
</event>
2020-07-22 01:56:09 +00:00
</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>