Implemented moving and deadly Obstacles

Therefour changes in ObstacleClass
MoveEdges are not outer limit of Movement!!! (Should be changed)
This commit is contained in:
=
2016-12-11 11:03:21 +01:00
parent c0a398fa5d
commit 45b9c41ea4
27 changed files with 729 additions and 466 deletions

View File

@ -1,7 +1,7 @@
<levelPack>
<world>GRASSLANDS</world>
<levels class="java.util.ArrayList">
<level number="1" goalX="22.606565" startSpeed="0.25" endSpeed="0.7" terrainEdge="-0.6" ceilingEdge="1.0">
<level number="1" goalX="22.606565" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="0.5854988" width="7.1709976"/>
<tileData x="10.153494" width="10.408993"/>
@ -9,10 +9,10 @@
</terrainTiles>
<ceilingTiles class="java.util.ArrayList"/>
<obstacles class="java.util.ArrayList">
<obstacleData type="" leftEdge="10.873024" rightEdge="11.427025" height="0.304" y="-0.448" attachedToGround="true"/>
<obstacleData type="" leftEdge="14.860029" rightEdge="15.360029" height="0.3" y="-0.45000002" attachedToGround="true"/>
<obstacleData type="" leftEdge="20.096622" rightEdge="22.096622" height="0.25" y="-0.47500002" attachedToGround="true"/>
<obstacleData type="" leftEdge="22.166656" rightEdge="22.666656" height="0.639" y="-0.28050002" attachedToGround="true"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="10.873024" rightEdge="11.427025" height="0.304" y="-0.448"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="14.860029" rightEdge="15.360029" height="0.3" y="-0.45000002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="20.096622" rightEdge="22.096622" height="0.25" y="-0.47500002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="22.166656" rightEdge="22.666656" height="0.639" y="-0.28050002"/>
</obstacles>
<stars class="java.util.ArrayList">
<starData index="1" x="11.159975" y="-0.15999995" width="0.25" height="0.25"/>
@ -20,7 +20,7 @@
<starData index="3" x="22.043303" y="-0.20666662" width="0.25" height="0.25"/>
</stars>
</level>
<level number="2" goalX="22.366613" startSpeed="0.25" endSpeed="0.7" terrainEdge="-0.6" ceilingEdge="1.0">
<level number="2" goalX="22.366613" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="0.9448314" width="7.8896627"/>
<tileData x="8.345928" width="4.4445295"/>
@ -30,16 +30,16 @@
</terrainTiles>
<ceilingTiles class="java.util.ArrayList"/>
<obstacles class="java.util.ArrayList">
<obstacleData type="" leftEdge="3.3708305" rightEdge="4.8758307" height="0.2" y="-0.5" attachedToGround="true"/>
<obstacleData type="" leftEdge="11.334382" rightEdge="11.912381" height="0.319" y="-0.44050002" attachedToGround="true"/>
<obstacleData type="" leftEdge="2.4509985" rightEdge="3.3089983" height="0.275" y="-0.46250004" attachedToGround="true"/>
<obstacleData type="" leftEdge="1.6111658" rightEdge="2.3221657" height="0.338" y="-0.43100002" attachedToGround="true"/>
<obstacleData type="" leftEdge="16.037212" rightEdge="16.856213" height="0.435" y="-0.38250002" attachedToGround="true"/>
<obstacleData type="" leftEdge="16.873312" rightEdge="17.873312" height="0.367" y="-0.41650003" attachedToGround="true"/>
<obstacleData type="" leftEdge="17.884027" rightEdge="18.896029" height="0.327" y="-0.4365" attachedToGround="true"/>
<obstacleData type="" leftEdge="19.046677" rightEdge="19.546677" height="0.884" y="-0.15800002" attachedToGround="true"/>
<obstacleData type="" leftEdge="15.948046" rightEdge="16.852045" height="0.5" y="-0.35000002" attachedToGround="true"/>
<obstacleData type="" leftEdge="20.123379" rightEdge="20.623379" height="0.5" y="-0.35000002" attachedToGround="true"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="3.3708305" rightEdge="4.8758307" height="0.2" y="-0.5"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="11.334382" rightEdge="11.912381" height="0.319" y="-0.44050002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="2.4509985" rightEdge="3.3089983" height="0.275" y="-0.46250004"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="1.6111658" rightEdge="2.3221657" height="0.338" y="-0.43100002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="16.037212" rightEdge="16.856213" height="0.435" y="-0.38250002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="16.873312" rightEdge="17.873312" height="0.367" y="-0.41650003"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="17.884027" rightEdge="18.896029" height="0.327" y="-0.4365"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="19.046677" rightEdge="19.546677" height="0.884" y="-0.15800002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="15.948046" rightEdge="16.852045" height="0.5" y="-0.35000002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="20.123379" rightEdge="20.623379" height="0.5" y="-0.35000002"/>
</obstacles>
<stars class="java.util.ArrayList">
<starData index="1" x="10.94335" y="-0.61999965" width="0.25" height="0.25"/>
@ -47,7 +47,7 @@
<starData index="3" x="18.893328" y="-0.12666662" width="0.25" height="0.25"/>
</stars>
</level>
<level number="3" goalX="19.200012" startSpeed="0.25" endSpeed="0.7" terrainEdge="-0.6" ceilingEdge="1.0">
<level number="3" goalX="19.200012" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="-0.4151678" width="5.1696644"/>
<tileData x="7.1337633" width="8.020197"/>
@ -55,12 +55,12 @@
</terrainTiles>
<ceilingTiles class="java.util.ArrayList"/>
<obstacles class="java.util.ArrayList">
<obstacleData type="" leftEdge="8.00651" rightEdge="8.67351" height="0.319" y="-0.44050002" attachedToGround="true"/>
<obstacleData type="" leftEdge="11.703371" rightEdge="12.7233715" height="0.299" y="-0.4505" attachedToGround="true"/>
<obstacleData type="" leftEdge="15.164396" rightEdge="15.762396" height="0.466" y="-0.36700004" attachedToGround="true"/>
<obstacleData type="" leftEdge="15.891703" rightEdge="16.901701" height="0.402" y="-0.39900002" attachedToGround="true"/>
<obstacleData type="" leftEdge="16.998373" rightEdge="18.248373" height="0.353" y="-0.42350003" attachedToGround="true"/>
<obstacleData type="" leftEdge="18.396694" rightEdge="18.896694" height="0.789" y="-0.20550004" attachedToGround="true"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="8.00651" rightEdge="8.67351" height="0.319" y="-0.44050002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="11.703371" rightEdge="12.7233715" height="0.299" y="-0.4505"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="15.164396" rightEdge="15.762396" height="0.466" y="-0.36700004"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="15.891703" rightEdge="16.901701" height="0.402" y="-0.39900002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="16.998373" rightEdge="18.248373" height="0.353" y="-0.42350003"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="18.396694" rightEdge="18.896694" height="0.789" y="-0.20550004"/>
</obstacles>
<stars class="java.util.ArrayList">
<starData index="1" x="2.6399994" y="0.10666669" width="0.25" height="0.25"/>
@ -68,7 +68,7 @@
<starData index="3" x="12.253348" y="-0.13333318" width="0.25" height="0.25"/>
</stars>
</level>
<level number="4" goalX="23.933224" startSpeed="0.25" endSpeed="0.7" terrainEdge="-0.6" ceilingEdge="1.0">
<level number="4" goalX="23.933224" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="6.06402" width="18.12804"/>
<tileData x="19.269924" width="3.0757751"/>
@ -78,13 +78,13 @@
<tileData x="23.786556" width="0.29333496"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList">
<obstacleData type="" leftEdge="1.9489989" rightEdge="2.5509992" height="0.354" y="-0.42300004" attachedToGround="true"/>
<obstacleData type="" leftEdge="18.512207" rightEdge="21.241207" height="0.408" y="0.50399995" attachedToGround="false"/>
<obstacleData type="" leftEdge="8.408872" rightEdge="11.137872" height="0.803" y="-0.19850004" attachedToGround="true"/>
<obstacleData type="" leftEdge="11.196732" rightEdge="14.196732" height="0.5" y="0.3966666" attachedToGround="false"/>
<obstacleData type="" leftEdge="14.865067" rightEdge="17.775066" height="0.299" y="0.48666632" attachedToGround="false"/>
<obstacleData type="" leftEdge="17.824553" rightEdge="18.475554" height="1.415" y="0.10749996" attachedToGround="true"/>
<obstacleData type="" leftEdge="5.79467" rightEdge="8.37867" height="0.544" y="-0.328" attachedToGround="true"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="1.9489989" rightEdge="2.5509992" height="0.354" y="-0.42300004"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="18.512207" rightEdge="21.241207" height="0.408" y="0.50399995"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="8.408872" rightEdge="11.137872" height="0.803" y="-0.19850004"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="11.196732" rightEdge="14.196732" height="0.5" y="0.3966666"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="14.865067" rightEdge="17.775066" height="0.299" y="0.48666632"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="17.824553" rightEdge="18.475554" height="1.415" y="0.10749996"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="5.79467" rightEdge="8.37867" height="0.544" y="-0.328"/>
</obstacles>
<stars class="java.util.ArrayList">
<starData index="1" x="11.560022" y="-0.26000002" width="0.25" height="0.25"/>
@ -92,17 +92,17 @@
<starData index="3" x="21.9833" y="-0.099999994" width="0.25" height="0.25"/>
</stars>
</level>
<level number="5" goalX="16.249996" startSpeed="0.25" endSpeed="0.7" terrainEdge="-0.6" ceilingEdge="1.0">
<level number="5" goalX="16.249996" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="1.9915047" width="9.983009"/>
<tileData x="12.045149" width="7.65627"/>
</terrainTiles>
<ceilingTiles class="java.util.ArrayList"/>
<obstacles class="java.util.ArrayList">
<obstacleData type="" leftEdge="2.3669987" rightEdge="2.7929988" height="1.074" y="-0.06300002" attachedToGround="true"/>
<obstacleData type="" leftEdge="12.000204" rightEdge="13.373203" height="0.946" y="-0.12700003" attachedToGround="true"/>
<obstacleData type="" leftEdge="13.539708" rightEdge="15.093709" height="0.725" y="-0.23750001" attachedToGround="true"/>
<obstacleData type="" leftEdge="15.29672" rightEdge="15.79672" height="1.539" y="0.1695" attachedToGround="true"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="2.3669987" rightEdge="2.7929988" height="1.074" y="-0.06300002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="12.000204" rightEdge="13.373203" height="0.946" y="-0.12700003"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="13.539708" rightEdge="15.093709" height="0.725" y="-0.23750001"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="15.29672" rightEdge="15.79672" height="1.539" y="0.1695"/>
</obstacles>
<stars class="java.util.ArrayList">
<starData index="1" x="2.5799987" y="0.62" width="0.25" height="0.25"/>
@ -110,7 +110,7 @@
<starData index="3" x="11.85002" y="-0.4533334" width="0.25" height="0.25"/>
</stars>
</level>
<level number="6" goalX="27.539873" startSpeed="0.25" endSpeed="0.7" terrainEdge="-0.6" ceilingEdge="1.0">
<level number="6" goalX="27.539873" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="0.4867487" width="6.9734974"/>
<tileData x="7.8615937" width="5.390193"/>
@ -119,20 +119,20 @@
</terrainTiles>
<ceilingTiles class="java.util.ArrayList"/>
<obstacles class="java.util.ArrayList">
<obstacleData type="" leftEdge="1.1131666" rightEdge="1.5001667" height="0.941" y="-0.12950003" attachedToGround="true"/>
<obstacleData type="" leftEdge="1.6498328" rightEdge="1.7768329" height="0.902" y="-0.14900002" attachedToGround="true"/>
<obstacleData type="" leftEdge="1.9103339" rightEdge="2.1163337" height="0.838" y="-0.18100002" attachedToGround="true"/>
<obstacleData type="" leftEdge="2.224499" rightEdge="2.415499" height="0.735" y="-0.23250002" attachedToGround="true"/>
<obstacleData type="" leftEdge="2.500666" rightEdge="2.6726658" height="0.613" y="-0.29350004" attachedToGround="true"/>
<obstacleData type="" leftEdge="2.7449994" rightEdge="3.9749994" height="0.5" y="-0.35000002" attachedToGround="true"/>
<obstacleData type="" leftEdge="5.1713314" rightEdge="5.955332" height="0.186" y="-0.507" attachedToGround="true"/>
<obstacleData type="" leftEdge="10.060041" rightEdge="10.560041" height="0.843" y="-0.17850003" attachedToGround="true"/>
<obstacleData type="" leftEdge="20.506636" rightEdge="20.806635" height="0.558" y="-0.321" attachedToGround="true"/>
<obstacleData type="" leftEdge="20.5105" rightEdge="20.8095" height="0.286" y="0.9333331" attachedToGround="false"/>
<obstacleData type="" leftEdge="14.943075" rightEdge="16.437075" height="0.231" y="-0.48450002" attachedToGround="true"/>
<obstacleData type="" leftEdge="25.300407" rightEdge="26.619408" height="0.612" y="-0.29400003" attachedToGround="true"/>
<obstacleData type="" leftEdge="23.873228" rightEdge="24.373228" height="0.5" y="-0.35000002" attachedToGround="true"/>
<obstacleData type="" leftEdge="24.34991" rightEdge="24.84991" height="0.5" y="-0.35000002" attachedToGround="true"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="1.1131666" rightEdge="1.5001667" height="0.941" y="-0.12950003"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="1.6498328" rightEdge="1.7768329" height="0.902" y="-0.14900002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="1.9103339" rightEdge="2.1163337" height="0.838" y="-0.18100002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="2.224499" rightEdge="2.415499" height="0.735" y="-0.23250002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="2.500666" rightEdge="2.6726658" height="0.613" y="-0.29350004"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="2.7449994" rightEdge="3.9749994" height="0.5" y="-0.35000002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="5.1713314" rightEdge="5.955332" height="0.186" y="-0.507"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="10.060041" rightEdge="10.560041" height="0.843" y="-0.17850003"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="20.506636" rightEdge="20.806635" height="0.558" y="-0.321"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="20.5105" rightEdge="20.8095" height="0.286" y="0.9333331"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="14.943075" rightEdge="16.437075" height="0.231" y="-0.48450002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="25.300407" rightEdge="26.619408" height="0.612" y="-0.29400003"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="23.873228" rightEdge="24.373228" height="0.5" y="-0.35000002"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="24.34991" rightEdge="24.84991" height="0.5" y="-0.35000002"/>
</obstacles>
<stars class="java.util.ArrayList">
<starData index="1" x="4.586666" y="-0.5866665" width="0.25" height="0.25"/>
@ -140,7 +140,7 @@
<starData index="3" x="20.64665" y="0.39999995" width="0.25" height="0.25"/>
</stars>
</level>
<level number="7" goalX="25.866587" startSpeed="0.25" endSpeed="0.7" terrainEdge="-0.6" ceilingEdge="1.0">
<level number="7" goalX="25.866587" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="2.1916704" width="10.383341"/>
<tileData x="11.639271" width="7.31187"/>
@ -151,19 +151,19 @@
<tileData x="25.669922" width="0.39332962"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList">
<obstacleData type="" leftEdge="2.9593315" rightEdge="3.9473314" height="0.313" y="-0.01333334" attachedToGround="false"/>
<obstacleData type="" leftEdge="3.987667" rightEdge="5.565667" height="0.272" y="-0.046666723" attachedToGround="false"/>
<obstacleData type="" leftEdge="10.1723585" rightEdge="12.214358" height="0.095" y="0.027500032" attachedToGround="false"/>
<obstacleData type="" leftEdge="5.595845" rightEdge="6.950845" height="0.19" y="-0.073333286" attachedToGround="false"/>
<obstacleData type="" leftEdge="8.669004" rightEdge="10.151005" height="0.218" y="0.0023332927" attachedToGround="false"/>
<obstacleData type="" leftEdge="6.992841" rightEdge="7.353841" height="0.558" y="-0.321" attachedToGround="true"/>
<obstacleData type="" leftEdge="19.32099" rightEdge="19.718988" height="0.762" y="-0.21900001" attachedToGround="true"/>
<obstacleData type="" leftEdge="19.963318" rightEdge="20.463318" height="0.5" y="0.7533332" attachedToGround="false"/>
<obstacleData type="" leftEdge="20.287636" rightEdge="21.245636" height="0.435" y="-0.38250002" attachedToGround="true"/>
<obstacleData type="" leftEdge="12.539991" rightEdge="13.659992" height="0.395" y="0.124166645" attachedToGround="false"/>
<obstacleData type="" leftEdge="11.773358" rightEdge="12.273358" height="0.884" y="0.5499999" attachedToGround="false"/>
<obstacleData type="" leftEdge="20.503757" rightEdge="21.642757" height="0.327" y="0.3799999" attachedToGround="false"/>
<obstacleData type="" leftEdge="24.1271" rightEdge="24.886099" height="0.694" y="-0.25300002" attachedToGround="true"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.9593315" rightEdge="3.9473314" height="0.313" y="-0.01333334"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="3.987667" rightEdge="5.565667" height="0.272" y="-0.046666723"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="10.1723585" rightEdge="12.214358" height="0.095" y="0.027500032"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="5.595845" rightEdge="6.950845" height="0.19" y="-0.073333286"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="8.669004" rightEdge="10.151005" height="0.218" y="0.0023332927"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="6.992841" rightEdge="7.353841" height="0.558" y="-0.321"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="19.32099" rightEdge="19.718988" height="0.762" y="-0.21900001"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="19.963318" rightEdge="20.463318" height="0.5" y="0.7533332"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="20.287636" rightEdge="21.245636" height="0.435" y="-0.38250002"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="12.539991" rightEdge="13.659992" height="0.395" y="0.124166645"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="11.773358" rightEdge="12.273358" height="0.884" y="0.5499999"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="20.503757" rightEdge="21.642757" height="0.327" y="0.3799999"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="24.1271" rightEdge="24.886099" height="0.694" y="-0.25300002"/>
</obstacles>
<stars class="java.util.ArrayList">
<starData index="1" x="6.6800065" y="-0.38666666" width="0.25" height="0.25"/>
@ -171,7 +171,7 @@
<starData index="3" x="20.679989" y="0.85333335" width="0.25" height="0.25"/>
</stars>
</level>
<level number="8" goalX="17.896662" startSpeed="0.25" endSpeed="0.7" terrainEdge="-0.6" ceilingEdge="1.0">
<level number="8" goalX="17.896662" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="-2.0766673" width="1.8466654"/>
<tileData x="2.5266657" width="0.7200012"/>
@ -180,16 +180,16 @@
</terrainTiles>
<ceilingTiles class="java.util.ArrayList"/>
<obstacles class="java.util.ArrayList">
<obstacleData type="" leftEdge="4.979664" rightEdge="5.9736643" height="0.286" y="-0.89333284" attachedToGround="false"/>
<obstacleData type="" leftEdge="3.057998" rightEdge="3.9619977" height="0.299" y="-0.81333286" attachedToGround="false"/>
<obstacleData type="" leftEdge="3.9729972" rightEdge="4.9669976" height="0.286" y="-0.8533326" attachedToGround="false"/>
<obstacleData type="" leftEdge="5.997839" rightEdge="6.8288393" height="0.231" y="-0.9199996" attachedToGround="false"/>
<obstacleData type="" leftEdge="11.854198" rightEdge="13.119198" height="1.02" y="0.023333304" attachedToGround="false"/>
<obstacleData type="" leftEdge="13.15453" rightEdge="13.805531" height="0.639" y="0.13999994" attachedToGround="false"/>
<obstacleData type="" leftEdge="14.541548" rightEdge="15.698547" height="0.422" y="-0.38900003" attachedToGround="true"/>
<obstacleData type="" leftEdge="11.286684" rightEdge="14.286684" height="0.218" y="-1.1266662" attachedToGround="false"/>
<obstacleData type="" leftEdge="6.876839" rightEdge="7.689839" height="0.286" y="-1.0" attachedToGround="false"/>
<obstacleData type="" leftEdge="-1.0233328" rightEdge="1.9766672" height="0.136" y="-0.86666656" attachedToGround="false"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="4.979664" rightEdge="5.9736643" height="0.286" y="-0.89333284"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="3.057998" rightEdge="3.9619977" height="0.299" y="-0.81333286"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="3.9729972" rightEdge="4.9669976" height="0.286" y="-0.8533326"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="5.997839" rightEdge="6.8288393" height="0.231" y="-0.9199996"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="11.854198" rightEdge="13.119198" height="1.02" y="0.023333304"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="13.15453" rightEdge="13.805531" height="0.639" y="0.13999994"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="14.541548" rightEdge="15.698547" height="0.422" y="-0.38900003"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="11.286684" rightEdge="14.286684" height="0.218" y="-1.1266662"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="6.876839" rightEdge="7.689839" height="0.286" y="-1.0"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="-1.0233328" rightEdge="1.9766672" height="0.136" y="-0.86666656"/>
</obstacles>
<stars class="java.util.ArrayList">
<starData index="1" x="2.543333" y="0.3933335" width="0.25" height="0.25"/>

View File

@ -1,93 +1,97 @@
<levelPack>
<world>TESTCAVE</world>
<levels class="java.util.ArrayList">
<level number="1" goalX="32.129963" startSpeed="0.25" endSpeed="0.7" terrainEdge="0.305" ceilingEdge="0.538">
<level number="1" goalX="33.663338" startSpeed="0.6" endSpeed="0.6" terrainEdge="-0.979" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="-2.5737498" width="0.85250044"/>
<tileData x="0.14783376" width="0.40066564"/>
<tileData x="1.9032495" width="0.47616577"/>
<tileData x="6.2710066" width="4.691348"/>
<tileData x="15.331669" width="36.663338"/>
</terrainTiles>
<ceilingTiles class="java.util.ArrayList">
<tileData x="0.37516427" width="6.7503285"/>
<tileData x="7.106504" width="3.0203505"/>
<tileData x="15.331669" width="36.663338"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList">
<obstacleData type="" leftEdge="9.0" rightEdge="10.0" height="0.3" y="0.455" attachedToGround="true"/>
<obstacleData type="" leftEdge="13.0" rightEdge="14.0" height="0.2" y="0.405" attachedToGround="true"/>
<obstacleData type="" leftEdge="19.52634" rightEdge="20.580341" height="0.3" y="0.455" attachedToGround="true"/>
<obstacleData type="" leftEdge="20.580004" rightEdge="21.580004" height="0.5" y="0.555" attachedToGround="true"/>
<obstacleData type="" leftEdge="21.580002" rightEdge="22.580002" height="0.1" y="0.35500002" attachedToGround="true"/>
<obstacleData type="" leftEdge="-0.25" rightEdge="0.25" height="0.5" y="0.0" attachedToGround="false"/>
<obstacleData type="" leftEdge="-0.25" rightEdge="0.25" height="0.5" y="0.0" attachedToGround="false"/>
<obstacleData type="" leftEdge="-0.32999998" rightEdge="0.17000002" height="0.5" y="0.48000002" attachedToGround="false"/>
<obstacleData type="" leftEdge="0.5966666" rightEdge="1.0966666" height="0.5" y="0.50666666" attachedToGround="false"/>
<obstacleData type="" leftEdge="3.2433324" rightEdge="3.7433324" height="0.5" y="0.45999995" attachedToGround="false"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="1.9099994" rightEdge="2.4099994" height="0.5" y="-0.729">
<moveComponent width="5.0" height="4.217" x="3.2333317" y="-0.729" speed="0.508"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="0.8499999" rightEdge="1.3499999" height="0.5" y="-0.729">
<moveComponent width="3.939" height="1.275" x="0.0" y="-0.729" speed="0.896"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="-2.6633325" rightEdge="-2.1633325" height="0.5" y="-0.729">
<moveComponent width="0.076" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
<obstacleData floating="true" moving="true" deadly="true" leftEdge="1.2500002" rightEdge="1.7500002" height="0.5" y="0.24666664">
<moveComponent width="2.841" height="1.212" x="1.5000002" y="0.24666664" speed="0.0"/>
</obstacleData>
</obstacles>
<stars class="java.util.ArrayList">
<starData index="1" x="10.163283" y="-0.05999978" width="0.25" height="0.25"/>
<starData index="2" x="19.366709" y="-0.046666652" width="0.25" height="0.25"/>
<starData index="3" x="21.73662" y="0.05333341" width="0.25" height="0.25"/>
</stars>
<stars class="java.util.ArrayList"/>
</level>
<level number="3" goalX="8.616679" startSpeed="0.19" endSpeed="0.44" terrainEdge="-0.861" ceilingEdge="-0.637">
<level number="2" goalX="13.38005" startSpeed="0.5" endSpeed="0.6" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="-0.19666648" width="5.606667"/>
<tileData x="2.2557545" width="10.511509"/>
<tileData x="8.660347" width="0.8236685"/>
<tileData x="11.630615" width="3.498868"/>
</terrainTiles>
<ceilingTiles class="java.util.ArrayList">
<tileData x="-2.2467475" width="1.5065048"/>
<tileData x="1.1300858" width="0.893161"/>
<tileData x="5.396673" width="6.440013"/>
<tileData x="5.1900253" width="16.38005"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList">
<obstacleData type="" leftEdge="1.3278332" rightEdge="3.098833" height="0.5" y="-0.2733331" attachedToGround="false"/>
<obstacleData type="" leftEdge="4.0364995" rightEdge="6.2235" height="0.109" y="0.61333334" attachedToGround="false"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="0.46000051" rightEdge="0.9600005" height="0.694" y="0.15333341"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="1.0306667" rightEdge="1.4826666" height="0.789" y="0.08666667"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="1.5308328" rightEdge="2.2358327" height="0.68" y="0.07333334"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.376332" rightEdge="2.810332" height="0.816" y="0.25333333"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="2.9108317" rightEdge="3.2358315" height="0.844" y="0.15333337"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="3.3118312" rightEdge="3.6548312" height="0.98" y="-0.110000014"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="3.883165" rightEdge="4.190165" height="0.68" y="-0.26000002"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="4.8149962" rightEdge="5.2849965" height="0.422" y="0.25999996"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="5.329664" rightEdge="5.9436646" height="0.544" y="0.060000002"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="6.0306664" rightEdge="6.482666" height="0.83" y="0.13333333"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="6.600003" rightEdge="6.980003" height="0.735" y="0.033333324"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="7.1111717" rightEdge="7.3821716" height="0.626" y="0.19999996"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="7.416671" rightEdge="8.916671" height="0.272" y="0.1866666"/>
<obstacleData floating="false" moving="false" deadly="false" leftEdge="9.453531" rightEdge="10.266531" height="0.136" y="-0.532"/>
<obstacleData floating="true" moving="false" deadly="false" leftEdge="11.386221" rightEdge="13.067221" height="0.34" y="0.07999999"/>
</obstacles>
<stars class="java.util.ArrayList">
<starData index="1" x="6.0466657" y="0.83333325" width="0.25" height="0.25"/>
<starData index="1" x="3.0633316" y="-0.43333337" width="0.25" height="0.25"/>
<starData index="2" x="9.686677" y="-0.76000005" width="0.25" height="0.25"/>
<starData index="3" x="13.110031" y="0.8466663" width="0.25" height="0.25"/>
</stars>
</level>
<level number="4" goalX="3.0" startSpeed="0.1" endSpeed="0.5" terrainEdge="-0.583" ceilingEdge="0.582">
<level number="3" goalX="16.630037" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="0.692">
<terrainTiles class="java.util.ArrayList">
<tileData x="6.8150187" width="19.630037"/>
</terrainTiles>
<ceilingTiles class="java.util.ArrayList">
<tileData x="-1.0400832" width="3.9198337"/>
<tileData x="8.253105" width="9.812542"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList">
<obstacleData floating="true" moving="true" deadly="true" leftEdge="1.9166656" rightEdge="2.4166656" height="0.5" y="0.2766666">
<moveComponent width="0.0" height="1.717" x="2.1666656" y="0.2766666" speed="0.0"/>
</obstacleData>
<obstacleData floating="false" moving="true" deadly="false" leftEdge="5.3966713" rightEdge="5.8966713" height="0.5" y="-0.35000002">
<moveComponent width="2.841" height="0.0" x="5.6466713" y="-0.35000002" speed="0.0"/>
</obstacleData>
<obstacleData floating="false" moving="false" deadly="true" leftEdge="9.8766775" rightEdge="10.3766775" height="0.5" y="-0.35000002">
<moveComponent width="0.0" height="0.0" x="0.0" y="0.0" speed="0.0"/>
</obstacleData>
<obstacleData floating="true" moving="true" deadly="false" leftEdge="14.763373" rightEdge="15.263373" height="0.5" y="0.21666658">
<moveComponent width="2.386" height="1.351" x="15.013373" y="0.21666658" speed="0.0"/>
</obstacleData>
</obstacles>
<stars class="java.util.ArrayList"/>
</level>
<level number="4" goalX="3.0" startSpeed="0.0" endSpeed="0.0" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="0.0" width="6.0"/>
</terrainTiles>
<ceilingTiles class="java.util.ArrayList">
<tileData x="0.0" width="6.0"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList"/>
<stars class="java.util.ArrayList"/>
</level>
<level number="5" goalX="2.606667" startSpeed="0.1" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="-0.19666648" width="5.606667"/>
</terrainTiles>
<ceilingTiles class="java.util.ArrayList">
<tileData x="-0.19666648" width="5.606667"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList"/>
<stars class="java.util.ArrayList"/>
</level>
<level number="6" goalX="6.053331" startSpeed="0.1" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="0.89166594" width="7.783332"/>
<tileData x="5.668331" width="0.769999"/>
</terrainTiles>
<ceilingTiles class="java.util.ArrayList">
<tileData x="-0.03000021" width="5.9399996"/>
<tileData x="4.4966655" width="3.113331"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList"/>
<stars class="java.util.ArrayList"/>
</level>
<level number="7" goalX="6.633333" startSpeed="0.1" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
<terrainTiles class="java.util.ArrayList">
<tileData x="0.8699992" width="7.7399983"/>
<tileData x="5.9866657" width="1.2933354"/>
</terrainTiles>
<ceilingTiles class="java.util.ArrayList">
<tileData x="1.8166666" width="9.633333"/>
</ceilingTiles>
<obstacles class="java.util.ArrayList"/>
<obstacles class="java.util.ArrayList">
<obstacleData floating="true" moving="true" deadly="false" leftEdge="-0.15199986" rightEdge="0.19200015" height="0.357" y="0.026666664">
<moveComponent width="1.288" height="1.111" x="0.020000145" y="0.026666664" speed="0.5"/>
</obstacleData>
</obstacles>
<stars class="java.util.ArrayList"/>
</level>
</levels>

View File

@ -34,6 +34,10 @@ public class Entity extends Quad {
position.y = terrainEdge + height / 2;
}
public void setTopEdge(float y){
position.y = y - height / 2;
}
public Texture getTexture() {
return texture;
}

View File

@ -1,18 +1,89 @@
package com.example.julian.endlessroll.entities;
import com.example.julian.endlessroll.data.Vector;
import com.example.julian.endlessroll.levels.MoveComponent;
import com.example.julian.endlessroll.levels.ObstacleData;
import com.example.julian.endlessroll.levels.worlds.World;
import com.example.julian.endlessroll.main.GameLog;
import java.util.Random;
/**
* Created by Julian on 20.11.2015.
*/
public class Obstacle extends Entity {
private boolean deadly;
private boolean floating;
private boolean moving;
private MoveComponent moveComponent;
private Vertex zeroPoint;
private boolean clockwise;
private float totalMoveDistance;
private float moveProgress;
public Obstacle(World world, ObstacleData data, float terrainEdge) {
super(world.getObstacle(), new Vector(data.getX(), data.getY()), data.getWidth(), data.getHeight());
if (data.isAttachedToGround())
super(world.getObstacleTexture(), new Vector(data.getX(), data.getY()), data.getWidth(), data.getHeight());
this.deadly = data.isDeadly();
this.floating = data.isFloating();
this.moving = data.isMoving();
this.moveComponent = data.getMoveComponent();
if (!floating)
super.setToTerrain(terrainEdge);
setTextureAtlasIndex();
if (moving)
randomMovementData();
}
public void moveWithMoveComponent(float value) {
float distance = value * moveComponent.getSpeed() * 0.001f;
moveProgress += distance / totalMoveDistance;
moveProgress %= 1.0f;
setPositionForMoveProgress();
}
private void setPositionForMoveProgress() {
float distance = 0;
Vertex lastVertex = zeroPoint;
while (true) {
Vertex nextVertex = lastVertex.getNext(clockwise);
float nextDistance = distance + (Math.abs(lastVertex.getX() - nextVertex.getX()) * 0.5f * moveComponent.getWidth()) + (Math.abs(lastVertex.getY() - nextVertex.getY()) * 0.5f * moveComponent.getHeight());
if (nextDistance >= moveProgress * totalMoveDistance) {
float distanceLeft = moveProgress * totalMoveDistance - distance;
Vector direction = new Vector(nextVertex.getX(), nextVertex.getY()).translate(new Vector(lastVertex.getX(), lastVertex.getY()).negate());
direction = direction.mul(0.5f * distanceLeft);
GameLog.i("Direction: "+direction.toString());
super.setPosition(moveComponent.getPositionOfVertex(lastVertex).translate(direction));
return;
}
distance = nextDistance;
lastVertex = nextVertex;
}
}
private void randomMovementData() {
Random random = new Random();
int index = random.nextInt(4);
zeroPoint = Vertex.values()[index];
clockwise = random.nextBoolean();
totalMoveDistance = moveComponent.getWidth() * 2 + moveComponent.getHeight() * 2;
}
private void setTextureAtlasIndex() {
if (deadly)
super.getTexture().setAtlasIndex(1);
if (floating)
super.getTexture().setAtlasIndex(2);
}
public boolean isMoving() {
return moving;
}
public boolean isDeadly() {
return deadly;
}
}

View File

@ -0,0 +1,45 @@
package com.example.julian.endlessroll.entities;
import com.example.julian.endlessroll.data.Vector;
import com.example.julian.endlessroll.main.GameLog;
/**
* Created by Julian on 11.12.2016.
*/
public enum Vertex {
UL(0, -1, 1), UR(1, 1, 1), BL(3, -1, -1), BR(2, 1, -1);
private int index;
private float x, y;
Vertex(int index, float x, float y) {
this.index = index;
this.x = x;
this.y = y;
}
public Vertex getNext(boolean clockwise) {
int newIndex = index + 1;
if (!clockwise)
newIndex = index - 1;
if (newIndex > 3)
newIndex = 0;
if (newIndex < 0)
newIndex = 3;
for (Vertex vertex : values())
if (vertex.index == newIndex)
return vertex;
GameLog.e("No vertex with index "+ index +" found!!!");
return null;
}
public float getX() {
return x;
}
public float getY() {
return y;
}
}

View File

@ -1,5 +1,6 @@
package com.example.julian.endlessroll.entities.collision;
import com.example.julian.endlessroll.entities.Obstacle;
import com.example.julian.endlessroll.entities.Player;
import com.example.julian.endlessroll.entities.Star;
import com.example.julian.endlessroll.entities.collision.collisionData.EntityCollisionData;
@ -29,6 +30,8 @@ public class CollisionManager {
PlayerCollisionData data = physics.getPlayerCollisionData(scene);
if (data.isTerrainCollision())
checkTerrainCollision(data.getTerrainCollisionData());
if (data.isCeilingCollision())
checkCeilingCollision(data.getCeilingCollisionData());
if (data.isObstacleCollision())
checkObstacleCollision(data.getObstacleCollisionData());
if (data.isToolCollision())
@ -43,6 +46,12 @@ public class CollisionManager {
game.onGameOver(true);
}
private void checkCeilingCollision(EntityCollisionData data) {
checkEntityCollision(data, -0.01f);
if (data.getEdge() == Edge.RIGHT || data.getEdge() == Edge.LEFT)
game.onGameOver(true);
}
private void checkToolCollision(ToolCollisionData data) {
for (Tool tool : data.getTools())
tool.onPlayerCollision(player);
@ -51,7 +60,7 @@ public class CollisionManager {
private void checkObstacleCollision(ObstacleCollisionData data) {
for (EntityCollisionData entityData : data.getCollisions()) {
checkEntityCollision(entityData, 0);
if (entityData.getEdge() != Edge.TOP)
if (entityData.getEdge() != Edge.TOP || ((Obstacle)entityData.getEntity()).isDeadly())
game.onGameOver(true);
}
}
@ -62,6 +71,10 @@ public class CollisionManager {
player.getMovement().y = 0;
player.setToTerrain(data.getEntity().getTopEdge());
break;
case BOTTOM:
player.getMovement().y = 0;
player.setTopEdge(data.getEntity().getBottomEdge());
break;
case LEFT:
player.getMovement().x *= xBounceFactor;
player.getPosition().x = data.getEntity().getLeftEdge() - player.RADIUS;

View File

@ -6,12 +6,14 @@ package com.example.julian.endlessroll.entities.collision.collisionData;
public class PlayerCollisionData {
private EntityCollisionData terrainCollision;
private EntityCollisionData ceilingCollision;
private ObstacleCollisionData obstacleCollision;
private ToolCollisionData toolCollision;
private EntityCollisionData starCollision;
public PlayerCollisionData(EntityCollisionData terrainCollision, ObstacleCollisionData obstacleCollision, ToolCollisionData toolCollision, EntityCollisionData starCollision) {
public PlayerCollisionData(EntityCollisionData terrainCollision, EntityCollisionData ceilingCollision, ObstacleCollisionData obstacleCollision, ToolCollisionData toolCollision, EntityCollisionData starCollision) {
this.terrainCollision = terrainCollision;
this.ceilingCollision = ceilingCollision;
this.obstacleCollision = obstacleCollision;
this.toolCollision = toolCollision;
this.starCollision = starCollision;
@ -25,6 +27,14 @@ public class PlayerCollisionData {
return terrainCollision;
}
public boolean isCeilingCollision() {
return ceilingCollision.isCollision();
}
public EntityCollisionData getCeilingCollisionData() {
return ceilingCollision;
}
public boolean isObstacleCollision() {
return obstacleCollision.isCollision();
}

View File

@ -10,6 +10,7 @@ import com.example.julian.endlessroll.entities.textures.Texture;
import com.example.julian.endlessroll.main.game.Timer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
@ -44,15 +45,17 @@ public class ParticleEffect {
private String textureName;
private Random random;
private List<ParticleSource> sources = new ArrayList<>();
private List<ParticleSource> sources = Collections.synchronizedList(new ArrayList<ParticleSource>());
public ParticleEffect() {
this.random = new Random();
}
public void update(Timer timer) {
for (ParticleSource source : sources)
source.update(timer);
synchronized (sources) {
for (ParticleSource source : sources)
source.update(timer);
}
}
public ParticleData createParticleData() {
@ -195,7 +198,7 @@ public class ParticleEffect {
return yOffset;
}
public List<ParticleSource> getSources() {
public synchronized List<ParticleSource> getSources() {
return sources;
}
@ -212,9 +215,11 @@ public class ParticleEffect {
}
public void deleteSources() {
for(ParticleSource source : sources)
source.kill();
sources.clear();
synchronized (sources) {
for (ParticleSource source : sources)
source.kill();
sources.clear();
}
}
public TimelineRange getSpawnWidth() {

View File

@ -29,22 +29,28 @@ public class ParticleSystem {
}
public void update(Timer timer) {
for (ParticleEffect effect : effects)
effect.update(timer);
}
public void loadTextures() throws Exception {
for (ParticleEffect effect : effects)
effect.setTexture(textureLoader.loadTexture("particleEffects/"+effect.getTextureName()));
}
public void deleteAllSources(){
for(ParticleEffect effect : effects){
effect.deleteSources();
synchronized (effects) {
for (ParticleEffect effect : effects)
effect.update(timer);
}
}
public ParticleEffect[] getEffects() {
public void loadTextures() throws Exception {
synchronized (effects) {
for (ParticleEffect effect : effects)
effect.setTexture(textureLoader.loadTexture("particleEffects/" + effect.getTextureName()));
}
}
public void deleteAllSources() {
synchronized (effects) {
for (ParticleEffect effect : effects) {
effect.deleteSources();
}
}
}
public synchronized ParticleEffect[] getEffects() {
return effects;
}
}

View File

@ -18,7 +18,6 @@ public class TintTimeline extends ParticleAttributeValue {
}
public void setValueOfPoint(int index, int colorIndex, float value) {
GameLog.i("Set value: index="+index+"; colorIndex="+colorIndex+"; value="+value);
if (points.size() <= index) {
points.add(new TintTimelinePoint());
}
@ -26,7 +25,6 @@ public class TintTimeline extends ParticleAttributeValue {
}
public void setTimeOfPoint(int index, float time) {
GameLog.i("Set time: index="+index+"; time="+time);
if (points.size() <= index) {
points.add(new TintTimelinePoint());
}

View File

@ -1,7 +1,6 @@
package com.example.julian.endlessroll.entities.tileLists;
import com.example.julian.endlessroll.data.SynchronizedArrayList;
import com.example.julian.endlessroll.entities.Entity;
import com.example.julian.endlessroll.entities.textures.Texture;
import com.example.julian.endlessroll.levels.TileData;
import com.example.julian.endlessroll.levels.worlds.World;
@ -38,7 +37,7 @@ public class TileList extends SynchronizedArrayList<Tile> {
}
public void loadData(World world, float edge, List<TileData> tileData) {
this.texture = world.getTerrain();
this.texture = world.getTerrainTexture();
this.endless = false;
super.clear();
for (TileData data : tileData)

View File

@ -0,0 +1,47 @@
package com.example.julian.endlessroll.levels;
import com.example.julian.endlessroll.data.Vector;
import com.example.julian.endlessroll.entities.Vertex;
import org.simpleframework.xml.Attribute;
public class MoveComponent {
@Attribute
private float width;
@Attribute
private float height;
@Attribute
private float x;
@Attribute
private float y;
@Attribute
private float speed;
public float getWidth() {
return width;
}
public float getHeight() {
return height;
}
public float getX() {
return x;
}
public float getY() {
return y;
}
public float getSpeed() {
return speed;
}
public Vector getPositionOfVertex(Vertex vertex) {
float x = this.x + (width / 2f) * vertex.getX();
float y = this.y + (height / 2f) * vertex.getY();
return new Vector(x, y);
}
}

View File

@ -1,6 +1,7 @@
package com.example.julian.endlessroll.levels;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
/**
* Created by Julian on 07.12.2015.
@ -8,7 +9,11 @@ import org.simpleframework.xml.Attribute;
public class ObstacleData {
@Attribute
private String type;
private boolean floating;
@Attribute
private boolean moving;
@Attribute
private boolean deadly;
@Attribute
private float leftEdge;
@Attribute
@ -17,11 +22,19 @@ public class ObstacleData {
private float height;
@Attribute
private float y;
@Attribute
public boolean attachedToGround;
@Element(required = false)
private MoveComponent moveComponent;
public String getType() {
return type;
public boolean isFloating() {
return floating;
}
public boolean isMoving() {
return moving;
}
public boolean isDeadly() {
return deadly;
}
public float getX() {
@ -40,7 +53,7 @@ public class ObstacleData {
return y;
}
public boolean isAttachedToGround() {
return attachedToGround;
public MoveComponent getMoveComponent() {
return moveComponent;
}
}

View File

@ -13,8 +13,8 @@ import com.example.julian.endlessroll.entities.textures.TexturePack;
public enum World {
GRASSLANDS(0, "Grasslands", R.drawable.grasslands_preview, R.drawable.background, R.drawable.terrain, R.drawable.obstacle),
TESTCAVE(1, "Testcave", R.drawable.grasslands_preview, R.drawable.background, R.drawable.terrain, R.drawable.obstacle),
ICY_MOUNTAINS(2, "Icy Mountains", R.drawable.grasslands_preview, R.drawable.background, R.drawable.terrain, R.drawable.obstacle);
TESTCAVE(1, "Testcave", R.drawable.grasslands_preview, R.drawable.background_cave, R.drawable.terrain, R.drawable.obstacle),
ICY_MOUNTAINS(2, "Icy Mountains", R.drawable.grasslands_preview, R.drawable.background_icymountains, R.drawable.terrain, R.drawable.obstacle);
private int index;
private String name;
@ -48,7 +48,7 @@ public enum World {
private void loadSpecificTextures(TexturePack texturePack) {
background = texturePack.loadTexture(backgroundId);
terrain = texturePack.loadTexture(terrainId);
obstacle = texturePack.loadTexture(obstacleId);
obstacle = texturePack.loadAtlas(obstacleId, 2, 2);
}
public int getIndex() {
@ -63,15 +63,15 @@ public enum World {
return previewId;
}
public Texture getBackground() {
public Texture getBackgroundTexture() {
return background;
}
public Texture getTerrain() {
public Texture getTerrainTexture() {
return terrain;
}
public Texture getObstacle() {
public Texture getObstacleTexture() {
return obstacle;
}
}

View File

@ -33,9 +33,9 @@ public class GameScene extends Scene {
private Goal goal;
private float goalX;
private List<Obstacle> obstacles = new ArrayList<>();
private List<Star> stars = new ArrayList<>();
private List<Tool> tools = new ArrayList<>();
private List<Obstacle> obstacles = Collections.synchronizedList(new ArrayList<Obstacle>());
private List<Star> stars = Collections.synchronizedList(new ArrayList<Star>());
private List<Tool> tools = Collections.synchronizedList(new ArrayList<Tool>());
public GameScene(TexturePack texturePack, ParticleSystem particleSystem) throws Exception {
super(texturePack, particleSystem);
@ -47,7 +47,7 @@ public class GameScene extends Scene {
public void loadLevel(Level level, World world) throws Exception {
this.currentWorld = world;
reset();
background.changeTexture(world.getBackground());
background.changeTexture(world.getBackgroundTexture());
terrain.loadData(world, level.getTerrainEdge(), level.getTerrainTiles());
ceiling.loadData(world, level.getCeilingEdge(), level.getCeilingTiles());
super.add(goal);
@ -78,12 +78,14 @@ public class GameScene extends Scene {
}
public void onStarCollision(Star collisionStar) {
Iterator<Star> iter = stars.iterator();
while (iter.hasNext()) {
Star star = iter.next();
if (star.equals(collisionStar)) {
star.destroy(DestroyEffect.STAR_EXPLOSION);
iter.remove();
synchronized (stars) {
Iterator<Star> iter = stars.iterator();
while (iter.hasNext()) {
Star star = iter.next();
if (star.equals(collisionStar)) {
star.destroy(DestroyEffect.STAR_EXPLOSION);
iter.remove();
}
}
}
}
@ -114,14 +116,17 @@ public class GameScene extends Scene {
public void update(Timer timer) {
super.update(timer);
player.setSpeedByProgress(player.getProgress() / goalX);
for (Tool tool : tools) {
tool.update(timer);
if (tool instanceof Bomb) {
Bomb bomb = (Bomb) tool;
if (bomb.isExploding())
bomb.explode(obstacles, collisionDetector);
synchronized (tools) {
for (Tool tool : tools) {
tool.update(timer);
if (tool instanceof Bomb) {
Bomb bomb = (Bomb) tool;
if (bomb.isExploding())
bomb.explode(obstacles, collisionDetector);
}
}
}
}
@Override
@ -135,15 +140,15 @@ public class GameScene extends Scene {
obstacles.remove(entity);
}
public List<Tool> getTools() {
public synchronized List<Tool> getTools() {
return tools;
}
public List<Obstacle> getObstacles() {
public synchronized List<Obstacle> getObstacles() {
return obstacles;
}
public List<Star> getStars() {
public synchronized List<Star> getStars() {
return stars;
}

View File

@ -5,6 +5,7 @@ import android.support.annotation.Nullable;
import com.example.julian.endlessroll.entities.Entity;
import com.example.julian.endlessroll.entities.Obstacle;
import com.example.julian.endlessroll.entities.Star;
import com.example.julian.endlessroll.entities.tileLists.Ceiling;
import com.example.julian.endlessroll.entities.tileLists.Terrain;
import com.example.julian.endlessroll.entities.tileLists.Tile;
import com.example.julian.endlessroll.entities.collision.CollisionDetector;
@ -36,6 +37,7 @@ public class Physics {
public void applyGravity(GameScene scene) {
scene.getPlayer().getMovement().y -= GRAVITY_FORCE;
synchronized (scene.getTools()){
for (Tool tool : scene.getTools()) {
if (tool.isFloating())
continue;
@ -70,15 +72,18 @@ public class Physics {
tool.setToTerrain(orientingHeight);
}
}
}
}}
@Nullable
private Obstacle getObstacleToolIsOver(Entity tool, List<Obstacle> obstacles) {
Map<Float, Obstacle> isOver = new HashMap<>();
synchronized (obstacles){
for (Obstacle obstacle : obstacles) {
if ((tool.getLeftEdge() >= obstacle.getLeftEdge() && tool.getLeftEdge() <= obstacle.getRightEdge()) || (tool.getRightEdge() <= obstacle.getRightEdge() && tool.getRightEdge() >= obstacle.getLeftEdge()))
boolean toolVertexInObstacleEdge = (tool.getLeftEdge() >= obstacle.getLeftEdge() && tool.getLeftEdge() <= obstacle.getRightEdge()) || (tool.getRightEdge() <= obstacle.getRightEdge() && tool.getRightEdge() >= obstacle.getLeftEdge());
boolean obstacleVertexInToolEdge = (obstacle.getLeftEdge() >= tool.getLeftEdge() && obstacle.getLeftEdge() <= tool.getRightEdge()) || (obstacle.getRightEdge() <= tool.getRightEdge() && obstacle.getRightEdge() >= tool.getLeftEdge());
if (toolVertexInObstacleEdge || obstacleVertexInToolEdge)
isOver.put(obstacle.getTopEdge(), obstacle);
}
}}
float max = -100;
for (float height : isOver.keySet()) {
if(isOver.get(height).getBottomEdge() < tool.getTopEdge()) {
@ -103,10 +108,11 @@ public class Physics {
public PlayerCollisionData getPlayerCollisionData(GameScene scene) {
EntityCollisionData terrainData = playerCollidesWithTerrain(scene);
EntityCollisionData ceilingData = playerCollidesWithCeiling(scene);
ObstacleCollisionData obstacleData = playerCollidesWithObstacle(scene);
ToolCollisionData toolData = playerCollidesWithTool(scene);
EntityCollisionData starData = playerCollidesWithStar(scene);
return new PlayerCollisionData(terrainData, obstacleData, toolData, starData);
return new PlayerCollisionData(terrainData, ceilingData, obstacleData, toolData, starData);
}
private EntityCollisionData playerCollidesWithTerrain(GameScene scene) {
@ -119,32 +125,45 @@ public class Physics {
return new EntityCollisionData(null, null);
}
private EntityCollisionData playerCollidesWithCeiling(GameScene scene) {
Ceiling ceiling = scene.getCeiling();
for (Tile ceilingTile : ceiling) {
EntityCollisionData data = detector.playerEntityCollision(scene.getPlayer(), ceilingTile);
if (data.isCollision())
return data;
}
return new EntityCollisionData(null, null);
}
private ObstacleCollisionData playerCollidesWithObstacle(GameScene scene) {
List<EntityCollisionData> collisions = new ArrayList<>();
synchronized (scene.getObstacles()){
for (Obstacle obstacle : scene.getObstacles()) {
EntityCollisionData data = detector.playerEntityCollision(scene.getPlayer(), obstacle);
if (data.isCollision())
collisions.add(data);
}
}}
return new ObstacleCollisionData(collisions);
}
private ToolCollisionData playerCollidesWithTool(GameScene scene) {
List<Tool> tools = new ArrayList<>();
Circle circle = new Circle(scene.getPlayer());
synchronized (scene.getTools()){
for (Tool tool : scene.getTools()) {
if (detector.circleToolCollision(circle, tool.getCollisionBounds()))
tools.add(tool);
}
}}
return new ToolCollisionData(tools);
}
private EntityCollisionData playerCollidesWithStar(GameScene scene) {
synchronized (scene.getStars()){
for (Star star : scene.getStars()) {
EntityCollisionData data = detector.playerEntityCollision(scene.getPlayer(), star);
if (data.isCollision())
return data;
}
}}
return new EntityCollisionData(null, null);
}
}

View File

@ -4,13 +4,13 @@ import com.example.julian.endlessroll.data.SynchronizedArrayList;
import com.example.julian.endlessroll.data.Vector;
import com.example.julian.endlessroll.entities.Background;
import com.example.julian.endlessroll.entities.Entity;
import com.example.julian.endlessroll.entities.Obstacle;
import com.example.julian.endlessroll.entities.Player;
import com.example.julian.endlessroll.entities.particles.ParticleSystem;
import com.example.julian.endlessroll.entities.textures.TexturePack;
import com.example.julian.endlessroll.entities.tileLists.Ceiling;
import com.example.julian.endlessroll.entities.tileLists.Terrain;
import com.example.julian.endlessroll.levels.worlds.World;
import com.example.julian.endlessroll.rendering.Lock;
import java.util.Iterator;
@ -35,9 +35,9 @@ public abstract class Scene extends SynchronizedArrayList<Entity> {
this.particleSystem = particleSystem;
setTexturePack(texturePack);
playerArrow = new Entity(textures.playerArrow, new Vector(0, 0.9f), .2f, .2f);
background = new Background(World.GRASSLANDS.getBackground());
terrain = new Terrain(World.GRASSLANDS.getTerrain());
ceiling = new Ceiling(World.GRASSLANDS.getTerrain());
background = new Background(World.GRASSLANDS.getBackgroundTexture());
terrain = new Terrain(World.GRASSLANDS.getTerrainTexture());
ceiling = new Ceiling(World.GRASSLANDS.getTerrainTexture());
player = new Player(textures.player);
}
@ -53,6 +53,11 @@ public abstract class Scene extends SynchronizedArrayList<Entity> {
Vector movement = entity.getMovement();
Vector finalMovement = new Vector(movement).mul(timer.getFrameTime());
entity.move(finalMovement);
if(entity instanceof Obstacle){
Obstacle obstacle = (Obstacle) entity;
if(obstacle.isMoving())
obstacle.moveWithMoveComponent(timer.getFrameTime());
}
if (entity.isDestroyed() && entity.getDestroyEffect() != null)
entity.getDestroyEffect().createEffect(particleSystem, new Vector(entity.getPosition()), new Vector(entity.getWidth(), entity.getHeight())).start();
if (entity.equals(player))

View File

@ -48,16 +48,19 @@ public class ParticleRenderer {
particleShader.start();
particleShader.loadMVPMatrix(matrixCreator, scene.cameraX);
for (ParticleEffect effect : scene.getParticleSystem().getEffects()) {
gl.glActiveTexture(GL10.GL_TEXTURE0);
gl.glBindTexture(GL10.GL_TEXTURE_2D, effect.getTexture().getId());
synchronized (scene.getParticleSystem().getEffects()) {
for (ParticleEffect effect : scene.getParticleSystem().getEffects()) {
gl.glActiveTexture(GL10.GL_TEXTURE0);
gl.glBindTexture(GL10.GL_TEXTURE_2D, effect.getTexture().getId());
switchAdditiveBlending(gl, effect.getOptions().isAdditive());
for (ParticleSource source : effect.getSources()) {
source.getActiveParticleLock().lock();
for (Particle particle : source.getActiveParticles())
renderParticle(particle);
source.getActiveParticleLock().unlock();
switchAdditiveBlending(gl, effect.getOptions().isAdditive());
synchronized (effect.getSources()){
for (ParticleSource source : effect.getSources()) {
source.getActiveParticleLock().lock();
for (Particle particle : source.getActiveParticles())
renderParticle(particle);
source.getActiveParticleLock().unlock();
}}
}
}
disableAdditiveBlending(gl);