Skip to content

Commit

Permalink
Level is generated randomly
Browse files Browse the repository at this point in the history
  • Loading branch information
filipbartek committed Feb 2, 2014
1 parent ab174c6 commit 4c9e5f8
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 35 deletions.
32 changes: 32 additions & 0 deletions studna.gmx/objects/obj_control.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<string>/// Set variables
view_main = VIEW_MAIN;

y_generate = 0;

</string>
</argument>
</arguments>
Expand Down Expand Up @@ -67,6 +69,36 @@ var yview = yavg - view_hview[view_main] / 2;
// Vertikalni pozice kamery ve svete (studni)
view_yview[view_main] = max(yview, view_yview[view_main]);

</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>/// Generate level layout
while (view_yview[view_main] + view_hview[view_main] &gt;= y_generate) {
spawn_wall(0, y_generate);
spawn_wall(room_width, y_generate);
for (var i = 0; i &lt; 1; i++) {
spawn_wall(irandom_range(0, room_width), y_generate);
}
y_generate += 32;
}

</string>
</argument>
</arguments>
Expand Down
40 changes: 5 additions & 35 deletions studna.gmx/rooms/room_well.room.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
</backgrounds>
<views>
<view visible="-1" objName="" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="0" vborder="0" hspeed="0" vspeed="-1"/>
<view visible="-1" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="0" vborder="0" hspeed="0" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
Expand All @@ -51,41 +51,11 @@
</views>
<instances>
<instance objName="obj_background" x="0" y="0" name="inst_0C041AD1" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="16" y="464" name="inst_9DA8348C" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="48" y="464" name="inst_4FCB6311" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="80" y="464" name="inst_E6EF3AD7" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="112" y="464" name="inst_240B2DDC" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="144" y="464" name="inst_77FA4A70" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="176" y="464" name="inst_36243F29" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="208" y="464" name="inst_A8B79EB4" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="240" y="464" name="inst_6F19CF03" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="272" y="464" name="inst_9E0ACAB9" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="304" y="464" name="inst_B818F33E" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="336" y="464" name="inst_0C9ACE65" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="368" y="464" name="inst_F8FE40C7" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="400" y="464" name="inst_65CEA564" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="256" y="224" name="inst_21ECE080" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="368" y="304" name="inst_48AB1279" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="208" y="336" name="inst_CDCE02F5" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="96" y="288" name="inst_9FAA0479" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="144" y="368" name="inst_97AE9342" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="272" y="304" name="inst_E0F6C13A" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="288" y="368" name="inst_85DB5A77" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="224" y="224" name="inst_B56CBB67" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="320" y="48" name="inst_1CB5DF6D" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="352" y="48" name="inst_67CC8FD0" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="448" y="80" name="inst_495486CF" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="448" y="112" name="inst_1BA5CEF5" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="448" y="144" name="inst_A0B3BC68" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="448" y="176" name="inst_46DE7019" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="448" y="208" name="inst_D793CB37" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="448" y="240" name="inst_595E8A82" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="240" y="112" name="inst_4DD7B5B1" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="288" y="144" name="inst_9C4ACFE0" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="144" y="112" name="inst_FA11E99F" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="48" y="96" name="inst_67CC8FD0" locked="0" code="" scaleX="2" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_wall" x="592" y="96" name="inst_46DE7019" locked="0" code="" scaleX="2" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_control" x="48" y="0" name="inst_7C83C396" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_pl1" x="96" y="240" name="inst_967A6393" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_pl2" x="240" y="192" name="inst_7FF17ED6" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_pl1" x="48" y="64" name="inst_967A6393" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="obj_pl2" x="592" y="64" name="inst_7FF17ED6" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
</instances>
<tiles/>
<PhysicsWorld>0</PhysicsWorld>
Expand Down
5 changes: 5 additions & 0 deletions studna.gmx/scripts/spawn_wall.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var pos_x = argument0;
var pos_y = argument1;

instance_create(pos_x, pos_y, obj_wall);

3 changes: 3 additions & 0 deletions studna.gmx/studna.project.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<background>background\background0</background>
</backgrounds>
<paths name="paths"/>
<scripts name="scripts">
<script>scripts\spawn_wall.gml</script>
</scripts>
<objects name="objects">
<object>objects\obj_control</object>
<object>objects\obj_background</object>
Expand Down

0 comments on commit 4c9e5f8

Please sign in to comment.