add broken ships

This commit is contained in:
SilicaAndPina 2020-09-09 11:53:46 +12:00
parent a9faaf94e6
commit 63ada3dd33
16 changed files with 330 additions and 16 deletions

View file

@ -0,0 +1,155 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>spr_broken_ship</spriteName>
<solid>0</solid>
<visible>-1</visible>
<depth>0</depth>
<persistent>0</persistent>
<parentName>obj_chunk_item</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>/// Init
image_speed = 0;
image_index = 0;
angle = random_range(0,180);
direction = angle;
image_angle = angle;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="1" 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>with(instance_create(x,y,obj_dropped_item))
{
item_id = METAL;
}
</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>/// Slow down if too fast
if(speed &gt; 0)
{
speed -= 1
}
pull_towards_black_holes();
</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>speed = -20;
</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>instance_destroy(id);
</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>

View file

@ -57,6 +57,31 @@ if(step_counter == 60*room_speed || instance_position(x,y,obj_chunk) == noone)
{
instance_destroy(self);
}
</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>instance_destroy(other);
instance_create(other.x,other.y,obj_boom_fx)
instance_destroy(id);
</string>
</argument>
</arguments>

View file

@ -29,15 +29,26 @@
instance_list = ds_list_create();
loaded = true;
var hasGeneratedBlackHole = false;
var hasGeneratedBrokenShip = false;
// GENERATION
for(var xx = 0; xx &lt; CHUNK_SIZE*TILE_SIZE; xx+= TILE_SIZE)
{
for(var yy = 0; yy &lt; CHUNK_SIZE*TILE_SIZE; yy+= TILE_SIZE)
{
var rnd = random_range(0,5000);
if(floor(rnd) == 1000)
var rnd = random_range(0,10000);
if(floor(rnd % 10000) == 8103)
{
if(hasGeneratedBrokenShip)
continue;
var inst = instance_create(x+xx,y+yy, obj_broken_ship);
inst.CHUNK_CONTAINED = self.id;
ds_list_add(instance_list, inst);
hasGeneratedBrokenShip = true;
continue;
}
if(floor(rnd % 5000) == 1000)
{
if(hasGeneratedBlackHole)
continue;

View file

@ -26,6 +26,7 @@
<argument>
<kind>1</kind>
<string>global.debug = false
global.hide = false;
</string>
</argument>
</arguments>
@ -50,15 +51,17 @@
<kind>1</kind>
<string>/// Draw HUD
if(!global.debug)
{
draw_set_color(c_white);
draw_healthbar(10,10,500,30,(obj_player.energy/obj_player.energy_max)*100,c_gray,c_blue,c_navy,0,true,false);
draw_text(11,13,string(obj_player.energy)+" / "+string(obj_player.energy_max));
draw_healthbar(10,40,300,60,(obj_player.hp/obj_player.hp_max)*100,c_gray,c_red,c_green,0,true,false);
draw_text(11,43,string(obj_player.hp)+" / "+string(obj_player.hp_max));
if(!global.hide){
if(!global.debug)
{
draw_set_color(c_white);
draw_healthbar(10,10,500,30,(obj_player.energy/obj_player.energy_max)*100,c_gray,c_blue,c_navy,0,true,false);
draw_text(11,13,string(obj_player.energy)+" / "+string(obj_player.energy_max));
draw_healthbar(10,40,300,60,(obj_player.hp/obj_player.hp_max)*100,c_gray,c_red,c_green,0,true,false);
draw_text(11,43,string(obj_player.hp)+" / "+string(obj_player.hp_max));
}
}
@ -184,6 +187,38 @@ else
{
global.debug = false
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="9" enumb="112">
<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.hide)
{
global.hide = true;
instance_destroy(obj_hotbar);
}
else
{
global.hide = false
instance_create(0,0,obj_hotbar);
}
</string>
</argument>
</arguments>

View file

@ -96,7 +96,7 @@ if(speed &gt; 0)
speed -= 1
}
if(energy &gt;= 10 &amp;&amp; is_moving &amp;&amp; keyboard_check(vk_shift))
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)
{
@ -258,6 +258,40 @@ if((mouse_check_button_pressed(mb_left) &amp;&amp; os_type != os_psvita) || game
}
</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>