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

@ -14,7 +14,7 @@
<sprite>sprites\spr_bullets</sprite>
<sprite>sprites\spr_blocks</sprite>
<sprite>sprites\spr_blackhole</sprite>
<sprite>sprites\spr_enemy</sprite>
<sprite>sprites\spr_broken_ship</sprite>
<sprite>sprites\spr_asteroid</sprite>
<sprite>sprites\spr_boom</sprite>
<sprite>sprites\spr_chunk</sprite>
@ -23,6 +23,7 @@
<sprite>sprites\spr_button</sprite>
<sprite>sprites\spr_hotbar</sprite>
<sprite>sprites\spr_intentory</sprite>
<sprite>sprites\s</sprite>
</sprites>
</sprites>
<backgrounds name="background">
@ -41,6 +42,7 @@
<objects name="objects">
<objects name="natural generation">
<object>objects\obj_asteriod</object>
<object>objects\obj_broken_ship</object>
<object>objects\obj_chunk_item</object>
<object>objects\obj_black_hole</object>
</objects>
@ -69,11 +71,12 @@
<room>rooms\rm_title</room>
<room>rooms\rm_game</room>
</rooms>
<constants number="4">
<constants number="5">
<constant name="TILE_SIZE">32</constant>
<constant name="CHUNK_SIZE">16</constant>
<constant name="AIR">0</constant>
<constant name="STONE">1</constant>
<constant name="METAL">2</constant>
</constants>
<help>
<rtf>help.rtf</rtf>

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>

BIN
sprites/images/s_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -22,5 +22,6 @@
<frames>
<frame index="0">images\spr_blocks_0.png</frame>
<frame index="1">images\spr_blocks_1.png</frame>
<frame index="2">images\spr_blocks_2.png</frame>
</frames>
</sprite>

View File

@ -20,6 +20,6 @@
<width>32</width>
<height>32</height>
<frames>
<frame index="0">images\spr_enemy_0.png</frame>
<frame index="0">images\spr_broken_ship_0.png</frame>
</frames>
</sprite>

View File

@ -0,0 +1,25 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<sprite>
<type>0</type>
<xorig>0</xorig>
<yorigin>0</yorigin>
<colkind>1</colkind>
<coltolerance>0</coltolerance>
<sepmasks>0</sepmasks>
<bboxmode>0</bboxmode>
<bbox_left>0</bbox_left>
<bbox_right>148</bbox_right>
<bbox_top>0</bbox_top>
<bbox_bottom>148</bbox_bottom>
<HTile>0</HTile>
<VTile>0</VTile>
<TextureGroups>
<TextureGroup0>0</TextureGroup0>
</TextureGroups>
<For3D>0</For3D>
<width>149</width>
<height>149</height>
<frames>
<frame index="0">images\spr_crafting_0.png</frame>
</frames>
</sprite>

View File

@ -0,0 +1,25 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<sprite>
<type>0</type>
<xorig>0</xorig>
<yorigin>0</yorigin>
<colkind>1</colkind>
<coltolerance>0</coltolerance>
<sepmasks>0</sepmasks>
<bboxmode>0</bboxmode>
<bbox_left>0</bbox_left>
<bbox_right>148</bbox_right>
<bbox_top>0</bbox_top>
<bbox_bottom>148</bbox_bottom>
<HTile>0</HTile>
<VTile>0</VTile>
<TextureGroups>
<TextureGroup0>0</TextureGroup0>
</TextureGroups>
<For3D>0</For3D>
<width>149</width>
<height>149</height>
<frames>
<frame index="0">images\spr_final_0.png</frame>
</frames>
</sprite>