Skip to content

Commit

Permalink
Drag & Drop Fortress System
Browse files Browse the repository at this point in the history
Fixes #148
  • Loading branch information
rafaelcp committed Dec 22, 2016
1 parent 746aa03 commit b53f7b7
Show file tree
Hide file tree
Showing 25 changed files with 554 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Configs/Default.config.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
<option_linux_display_name>Super Mega Engine</option_linux_display_name>
<option_linux_enable_steam>0</option_linux_enable_steam>
<option_linux_fullscreen>0</option_linux_fullscreen>
<option_linux_homepage>https://github.com/rafaelcp/Open-Mega-Engine</option_linux_homepage>
<option_linux_homepage>https://github.com/rafaelcp/Super-Mega-Engine</option_linux_homepage>
<option_linux_icon>Configs\Default\linux\icon64.png</option_linux_icon>
<option_linux_interpolate>-1</option_linux_interpolate>
<option_linux_long_desc>Super Mega Engine</option_linux_long_desc>
Expand Down
19 changes: 18 additions & 1 deletion OpenMegaEngine.project.gmx → SuperMegaEngine.project.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,13 @@
</sprites>
<sprites name="Fortress">
<sprite>sprites\sprFortressPoint</sprite>
<sprite>sprites\sprFortressTurnPoint</sprite>
<sprite>sprites\sprMM3Fortress</sprite>
<sprite>sprites\sprFortressSkull</sprite>
<sprite>sprites\sprFortressUp</sprite>
<sprite>sprites\sprFortressRight</sprite>
<sprite>sprites\sprFortressLeft</sprite>
<sprite>sprites\sprFortressDown</sprite>
</sprites>
</sprites>
<sprites name="Sections">
Expand Down Expand Up @@ -497,6 +502,8 @@
</scripts>
<scripts name="Instances">
<script>scripts\instanceInside.gml</script>
<script>scripts\instance_nth_nearest.gml</script>
<script>scripts\instance_distance.gml</script>
</scripts>
<scripts name="Debug">
<script>scripts\assert.gml</script>
Expand Down Expand Up @@ -705,7 +712,6 @@
<object>objects\objTitleScreen</object>
<object>objects\objShop</object>
<object>objects\objMapDrawer</object>
<object>objects\objFortress</object>
<object>objects\objMainMenu</object>
<object>objects\objLoadGame</object>
<object>objects\objSaveGame</object>
Expand Down Expand Up @@ -748,6 +754,17 @@
<object>objects\objWilyUFO</object>
<object>objects\objCredits</object>
</objects>
<objects name="Fortress">
<object>objects\objFortress</object>
<object>objects\objFortressPoint</object>
<object>objects\objFortressTurnPoint</object>
<object>objects\objFortressPointStart</object>
<object>objects\objFortressUp</object>
<object>objects\objFortressDown</object>
<object>objects\objFortressRight</object>
<object>objects\objFortressLeft</object>
<object>objects\objFortressSpot</object>
</objects>
</objects>
<rooms name="rooms">
<room>rooms\rmInit</room>
Expand Down
Binary file modified help.rtf
Binary file not shown.
74 changes: 61 additions & 13 deletions objects/objFortress.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,79 @@ if !global.fortressStarted {
}
}

var drawer;
alarm[11] = 1;


drawer[0] = instance_create(48, 192, objMapDrawer);
drawer[0].lines = makePath(0, 16, 16, 16, 16, 0, 32, 0, 32, 16, 48, 16, 48, 0);
global.fortressStarted = true;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="2" enumb="11">
<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>/// Create Paths

drawer[1] = instance_create(48 + 48, 192, objMapDrawer);
drawer[1].lines = makePath(16, 0, 16, -64);
drawer[1].place_icon = sprFortressSkull;
var drawer;

drawer[2] = instance_create(48 + 48 + 16, 192 - 64, objMapDrawer);
drawer[2].lines = makePath(16, 0, 16, 80);
drawer[2].place_icon = sprFortressSkull;
drawer[2].hidden = true;
currentObj = instance_find(objFortressPointStart, 0);

for (var i = 0; i &lt; global.numFortressLevels; i++) {
origin = currentObj;
x = 0;
y = 0;

drawer[i] = instance_create(currentObj.x, currentObj.y, objMapDrawer);
do {
deltaX = 0;
deltaY = 0;
do {
switch currentObj.dir {
case "right": deltaX = 16; break;
case "left": deltaX = -16; break;
case "down": deltaY = 16; break;
case "up": deltaY = -16; break;
}
oldX = x;
oldY = y;
x += deltaX;
y += deltaY;

if origin.x + x &gt; room_width || origin.y + y &gt; room_height || origin.x + x &lt; 0 || origin.y + y &lt; 0 {
exit;
}

var line = makeLine(oldX, oldY, x, y);
ds_list_add(drawer[i].lines, line);
next = instance_position(origin.x + x, origin.y + y, objFortressSpot);
} until (next &gt; -1);
currentObj = next;
} until (currentObj.object_index == objFortressPoint);

drawer[i].place_icon = currentObj.sprite_index;
drawer[i].hidden = currentObj.hidden;
if i != global.currentFortressLevel {
drawer[i].draw_speed = 0;
}
if global.fortressLevelDone[i] {
drawer[i].step = ds_list_size(drawer[i].lines);
}
}


global.fortressStarted = true;
</string>
</argument>
</arguments>
Expand Down
47 changes: 47 additions & 0 deletions objects/objFortressDown.object.gmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>sprFortressDown</spriteName>
<solid>0</solid>
<visible>0</visible>
<depth>0</depth>
<persistent>0</persistent>
<parentName>objFortressTurnPoint</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>dir = "down";
</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>
47 changes: 47 additions & 0 deletions objects/objFortressLeft.object.gmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>sprFortressLeft</spriteName>
<solid>0</solid>
<visible>0</visible>
<depth>0</depth>
<persistent>0</persistent>
<parentName>objFortressTurnPoint</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>dir = "left";
</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>
48 changes: 48 additions & 0 deletions objects/objFortressPoint.object.gmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>sprFortressPoint</spriteName>
<solid>0</solid>
<visible>0</visible>
<depth>0</depth>
<persistent>0</persistent>
<parentName>objFortressSpot</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>dir = "right";
hidden = false;
</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>
23 changes: 23 additions & 0 deletions objects/objFortressPointStart.object.gmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>sprFortressPoint</spriteName>
<solid>0</solid>
<visible>0</visible>
<depth>0</depth>
<persistent>0</persistent>
<parentName>objFortressPoint</parentName>
<maskName>&lt;undefined&gt;</maskName>
<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>
47 changes: 47 additions & 0 deletions objects/objFortressRight.object.gmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>sprFortressRight</spriteName>
<solid>0</solid>
<visible>0</visible>
<depth>0</depth>
<persistent>0</persistent>
<parentName>objFortressTurnPoint</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>dir = "right";
</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>
23 changes: 23 additions & 0 deletions objects/objFortressSpot.object.gmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>&lt;undefined&gt;</spriteName>
<solid>0</solid>
<visible>0</visible>
<depth>0</depth>
<persistent>0</persistent>
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
<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>
Loading

0 comments on commit b53f7b7

Please sign in to comment.