Fix crafting

This commit is contained in:
SilicaAndPina 2020-09-10 11:53:11 +12:00
parent b56635f6b1
commit 1ee935e406
6 changed files with 279 additions and 60 deletions

View File

@ -3,6 +3,7 @@
<Configs name="configs">
<Config>Configs\Default</Config>
</Configs>
<datafiles number="1" name="datafiles"/>
<NewExtensions/>
<sounds name="sound">
<sound>sound\snd_engine</sound>
@ -13,7 +14,6 @@
<sprite>sprites\spr_player</sprite>
<sprite>sprites\spr_bullets</sprite>
<sprite>sprites\spr_blocks</sprite>
<sprite>sprites\spr_blackhole</sprite>
<sprite>sprites\spr_broken_ship</sprite>
<sprite>sprites\spr_asteroid</sprite>
<sprite>sprites\spr_boom</sprite>
@ -24,6 +24,7 @@
<sprite>sprites\spr_hotbar</sprite>
<sprite>sprites\spr_intentory</sprite>
<sprite>sprites\spr_crafting</sprite>
<sprite>sprites\spr_blackhole</sprite>
<sprite>sprites\spr_final</sprite>
</sprites>
</sprites>
@ -61,6 +62,7 @@
<object>objects\obj_exit</object>
<object>objects\obj_gameover_overlay</object>
<object>objects\obj_inventory</object>
<object>objects\obj_crafting</object>
<object>objects\obj_hotbar</object>
</objects>
<objects name="items">

View File

@ -57,31 +57,6 @@ 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>
@ -128,6 +103,31 @@ instance_destroy(id);
<isnot>0</isnot>
</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>
</action>
</event>
<event eventtype="4" ename="obj_asteriod">
<action>
<libid>1</libid>

View File

@ -0,0 +1,191 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>spr_crafting</spriteName>
<solid>0</solid>
<visible>-1</visible>
<depth>-4000</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>selected_slot = 0;
move_slot = false;
selected_item = 0;
selected_total = 0;
</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>x = view_xview[0]+view_wview[0]/2 - (424/2);
y = view_yview[0]+view_hview[0]/2 - (254/2) - 200;
var i = 0;
if((mouse_x &gt;= x &amp;&amp; mouse_x &lt;= x+140) &amp;&amp; (mouse_y &gt;= y &amp;&amp; mouse_y &lt;= y+140))
{
for(yy = 8; yy &lt; (5*44); yy+=45)
{
for(xx = 6; xx &lt; (9*45); xx+=45+1)
{
if((mouse_x &gt;= x+xx &amp;&amp; mouse_x &lt;= x+xx+45) &amp;&amp; (mouse_y &gt;= y+yy &amp;&amp; mouse_y &lt;= y+yy+45))
{
selected_slot = i;
}
i++;
}
}
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="6" enumb="4">
<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(!move_slot)
{
selected_item = obj_inv_controller.inventory[selected_slot];
if(selected_item == 0)
return false;
selected_total = obj_inv_controller.inventoryCount[selected_slot];
obj_inv_controller.inventory[selected_slot] = 0;
obj_inv_controller.inventoryCount[selected_slot] = 0;
move_slot = true;
}
else
{
if(obj_inv_controller.inventory[selected_slot] == 0)
{
obj_inv_controller.inventory[selected_slot] = selected_item;
obj_inv_controller.inventoryCount[selected_slot] = selected_total;
move_slot = false;
selected_item = 0;
}
}
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="8" 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>draw_self();
var xx = 6;
var yy = 8;
var i = 0;
for(yy = 8; yy &lt; (5*44); yy+=45)
{
for(xx = 6; xx &lt; (9*45); xx+=45+1)
{
if(i == selected_slot)
{
draw_set_color(make_colour_rgb(100,100,100));
draw_rectangle(x+xx,y+yy,x+xx+45,y+yy+44,false)
}
draw_sprite(spr_blocks,obj_inv_controller.inventory[i],x+xx+6,y+yy+7);
var count = obj_inv_controller.inventoryCount[i];
var xoffset = string_width(string(count))
if(count &gt; 1)
{
draw_set_color(c_white);
draw_text(x+xx+45-xoffset,y+yy+30,string(count));
}
i++
}
}
if(selected_item != 0)
{
draw_sprite(spr_blocks,selected_item,mouse_x-(TILE_SIZE/2),mouse_y-(TILE_SIZE/2));
}
</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

@ -30,6 +30,32 @@
move_slot = false;
selected_item = 0;
selected_total = 0;
crafting_menu = instance_create(0,0,obj_crafting);
</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>instance_destroy(crafting_menu);
</string>
</argument>
</arguments>

View File

@ -258,40 +258,6 @@ 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>
@ -370,6 +336,40 @@ if(didAdd)
<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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 346 B