Levels Polished
Tutorial till level 5 done, but without images (TODO) Error with ToolSlotSettings fixed
This commit is contained in:
@ -1,28 +1,32 @@
|
||||
<levelPack id="5">
|
||||
<theme>TESTCAVE</theme>
|
||||
<levels class="java.util.ArrayList">
|
||||
<level packId="5" id="1" goalX="33.663338" startSpeed="0.6" endSpeed="0.6" terrainEdge="-0.979" ceilingEdge="1.0">
|
||||
<level packId="5" id="1" goalX="4.3969" startSpeed="0.6" endSpeed="0.6" terrainEdge="-0.176" ceilingEdge="0.747">
|
||||
<terrainTiles class="java.util.ArrayList">
|
||||
<tileData x="15.331669" width="36.663338"/>
|
||||
<tileData x="-2.4650004" width="1.0699992"/>
|
||||
<tileData x="1.3783364" width="5.4166737"/>
|
||||
</terrainTiles>
|
||||
<ceilingTiles class="java.util.ArrayList">
|
||||
<tileData x="15.331669" width="36.663338"/>
|
||||
<tileData x="-2.6666667" width="0.6666665"/>
|
||||
<tileData x="0.59333193" width="4.6533327"/>
|
||||
<tileData x="3.9584491" width="0.8769021"/>
|
||||
</ceilingTiles>
|
||||
<obstacles class="java.util.ArrayList">
|
||||
<obstacleData floating="false" moving="false" deadly="false" leftEdge="1.9099994" rightEdge="2.4099994" height="0.5" y="-0.729">
|
||||
<obstacleData floating="false" moving="false" deadly="false" leftEdge="3.6066647" rightEdge="4.1066647" height="0.5" y="0.074">
|
||||
<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">
|
||||
<obstacleData floating="false" moving="false" deadly="false" leftEdge="1.6499996" rightEdge="2.1499996" height="0.5" y="0.074">
|
||||
<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">
|
||||
<obstacleData floating="false" moving="false" deadly="false" leftEdge="-2.7566657" rightEdge="-2.2566657" height="0.5" y="0.074">
|
||||
<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 floating="true" moving="true" deadly="true" leftEdge="2.429999" rightEdge="2.929999" height="0.5" y="0.26666665">
|
||||
<moveComponent width="2.841" height="1.212" x="2.679999" y="0.26666665" speed="0.136"/>
|
||||
</obstacleData>
|
||||
</obstacles>
|
||||
<stars class="java.util.ArrayList"/>
|
||||
<energy x="0.013333277" y="0.32666668"/>
|
||||
</level>
|
||||
<level packId="5" id="2" goalX="13.38005" startSpeed="0.5" endSpeed="0.6" terrainEdge="-0.6" ceilingEdge="1.0">
|
||||
<terrainTiles class="java.util.ArrayList">
|
||||
|
@ -36,10 +36,10 @@ public class Level {
|
||||
@Element(required = false)
|
||||
private PositionData energy;
|
||||
|
||||
private boolean finished;
|
||||
private boolean locked;
|
||||
private boolean finished = false;
|
||||
private boolean locked = true;
|
||||
private boolean[] collectedStars = {false, false, false};
|
||||
private boolean energyCollected;
|
||||
private boolean energyCollected = false;
|
||||
|
||||
public int getPackId() {
|
||||
return packId;
|
||||
@ -139,7 +139,7 @@ public class Level {
|
||||
|
||||
public void reset() {
|
||||
finished = false;
|
||||
locked = false;
|
||||
locked = true;
|
||||
collectedStars = new boolean[]{false, false, false};
|
||||
energyCollected = false;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class LevelManager extends ArrayList<LevelPack> {
|
||||
dataStorageHandler.readLevelProgress(pack);
|
||||
dataStorageHandler.readLevelPackLocked(pack);
|
||||
pack.tryToUnlockFirstLevel();
|
||||
if (pack.getId() == 0)
|
||||
if (pack.getId() == 1)
|
||||
pack.setLocked(false);
|
||||
super.add(pack);
|
||||
} catch (Exception e) {
|
||||
@ -60,7 +60,7 @@ public class LevelManager extends ArrayList<LevelPack> {
|
||||
public void reset() {
|
||||
for (LevelPack pack : this) {
|
||||
pack.reset();
|
||||
if (pack.getId() == 0)
|
||||
if (pack.getId() == 1)
|
||||
pack.setLocked(false);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class LevelPack {
|
||||
private List<Level> levels;
|
||||
|
||||
private String name;
|
||||
private boolean locked;
|
||||
private boolean locked = true;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
@ -76,7 +76,7 @@ public class LevelPack {
|
||||
}
|
||||
|
||||
public void tryToUnlockFirstLevel() {
|
||||
Level firstLevel = getLevel(0);
|
||||
Level firstLevel = getLevel(1);
|
||||
if (firstLevel != null)
|
||||
firstLevel.setLocked(false);
|
||||
}
|
||||
|
@ -92,6 +92,12 @@ public class DataStorageHandler {
|
||||
database.close();
|
||||
}
|
||||
|
||||
public void clearLevelPackLocked() {
|
||||
database.open();
|
||||
database.clearLevelPackLocked();
|
||||
database.close();
|
||||
}
|
||||
|
||||
public void readLevelProgress(LevelPack levelPack) {
|
||||
database.open();
|
||||
for (Level level : levelPack.getLevels())
|
||||
|
@ -3,7 +3,6 @@ package com.example.julian.endlessroll.main.game;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import com.example.julian.endlessroll.R;
|
||||
import com.example.julian.endlessroll.data.Vector;
|
||||
import com.example.julian.endlessroll.entities.DestroyEffect;
|
||||
import com.example.julian.endlessroll.entities.Energy;
|
||||
@ -20,7 +19,6 @@ import com.example.julian.endlessroll.main.DataStorageHandler;
|
||||
import com.example.julian.endlessroll.main.GameHandler;
|
||||
import com.example.julian.endlessroll.main.GameLog;
|
||||
import com.example.julian.endlessroll.main.screens.Screen;
|
||||
import com.example.julian.endlessroll.main.tutorial.BreakPoint;
|
||||
import com.example.julian.endlessroll.main.tutorial.Tutorial;
|
||||
import com.example.julian.endlessroll.main.tutorial.TutorialManager;
|
||||
import com.example.julian.endlessroll.rendering.Rendering;
|
||||
@ -106,7 +104,10 @@ public class Game extends Rendering<GameScene> {
|
||||
this.levelPack = levelPack;
|
||||
if (scene != null) {
|
||||
gameState = GameState.COUNTDOWN;
|
||||
tutorialManager.resetTutorials();
|
||||
currentTutorial = tutorialManager.getTutorial(level);
|
||||
if (level.isFinished())
|
||||
currentTutorial = null;
|
||||
collectedStars.clear();
|
||||
energyCollected = false;
|
||||
particleSystem.deleteAllSources();
|
||||
@ -144,7 +145,8 @@ public class Game extends Rendering<GameScene> {
|
||||
playerSpeed = player.getSpeed();
|
||||
playerY = player.getPosition().y;
|
||||
}
|
||||
viewManager.update(gameState == GameState.RUNNING, timer, playerProgress, playerSpeed, playerY);
|
||||
viewManager.update(gameState == GameState.RUNNING, timer, playerProgress, playerSpeed,
|
||||
playerY);
|
||||
switch (gameState) {
|
||||
case RUNNING:
|
||||
if (player.getPosition().y < -2f) {
|
||||
@ -155,17 +157,19 @@ public class Game extends Rendering<GameScene> {
|
||||
onGoalReached();
|
||||
return;
|
||||
}
|
||||
physics.applyGravity(scene, timer);
|
||||
scene.update(timer);
|
||||
collisionManager.update(physics, scene);
|
||||
|
||||
if (currentTutorial != null) {
|
||||
currentTutorial.update(playerProgress);
|
||||
if (currentTutorial.isOverNewBreakPoints()) {
|
||||
gameState = GameState.PAUSED;
|
||||
handler.showTutorialScreen(currentTutorial.getCurrentBreakPoints());
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
physics.applyGravity(scene, timer);
|
||||
scene.update(timer);
|
||||
collisionManager.update(physics, scene);
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,7 +239,8 @@ public class Game extends Rendering<GameScene> {
|
||||
public void onGameOver(boolean playerExplode) {
|
||||
if (playerExplode) {
|
||||
scene.remove(player);
|
||||
DestroyEffect.EXPLOSION.createEffect(particleSystem, player.getPosition(), new Vector(player.getWidth(), player.getHeight())).start();
|
||||
DestroyEffect.EXPLOSION.createEffect(particleSystem, player.getPosition(),
|
||||
new Vector(player.getWidth(), player.getHeight())).start();
|
||||
}
|
||||
gameState = GameState.GAME_OVER;
|
||||
viewManager.showMessage(false, MessageType.GAME_OVER);
|
||||
|
@ -27,6 +27,12 @@ public class Tutorial {
|
||||
this.breakPoints = Arrays.asList(breakPoints);
|
||||
}
|
||||
|
||||
public void reset(){
|
||||
currentBreakPointIds.clear();
|
||||
lastBreakPointId = -1;
|
||||
overNewBreakPoints = false;
|
||||
}
|
||||
|
||||
public void update(float playerProgress) {
|
||||
playerProgress *= 2f;
|
||||
int nextBreakPoint = lastBreakPointId + 1;
|
||||
|
@ -3,7 +3,6 @@ package com.example.julian.endlessroll.main.tutorial;
|
||||
import com.example.julian.endlessroll.R;
|
||||
import com.example.julian.endlessroll.levels.Level;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -17,15 +16,23 @@ public class TutorialManager {
|
||||
|
||||
public TutorialManager() {
|
||||
Tutorial t11 = new Tutorial(1, 1, new BreakPoint(0, R.id.tutorial_welcome),
|
||||
new BreakPoint(0, R.id.tutorial_tools), new BreakPoint(7, R.id.tutorial_place_ramp),
|
||||
new BreakPoint(0, R.id.tutorial_tools),
|
||||
new BreakPoint(7, R.id.tutorial_place_ramp),
|
||||
new BreakPoint(21, R.id.tutorial_place_ramp_2));
|
||||
Tutorial t21 = new Tutorial(2, 1, new BreakPoint(11, R.id.tutorial_ramp_in_air));
|
||||
|
||||
tutorials = Arrays.asList(t11);
|
||||
tutorials = Arrays.asList(t11, t21);
|
||||
}
|
||||
|
||||
public void resetTutorials(){
|
||||
for(Tutorial tutorial : tutorials)
|
||||
tutorial.reset();
|
||||
}
|
||||
|
||||
public Tutorial getTutorial(Level level) {
|
||||
for(Tutorial tutorial : tutorials){
|
||||
if(tutorial.getLevelPackId() == level.getPackId() && tutorial.getLevelId() == level.getId())
|
||||
for (Tutorial tutorial : tutorials) {
|
||||
if (tutorial.getLevelPackId() == level.getPackId() && tutorial.getLevelId() == level
|
||||
.getId())
|
||||
return tutorial;
|
||||
}
|
||||
return null;
|
||||
|
@ -93,6 +93,10 @@ public class MyDatabase extends DatabaseAdapter {
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
public void clearLevelPackLocked(){
|
||||
super.clearTable(levelPackTable);
|
||||
}
|
||||
|
||||
public void writeBoughtTools() {
|
||||
for (ToolType tool : ToolType.values()) {
|
||||
if (tool != ToolType.NONE) {
|
||||
|
@ -13,9 +13,9 @@ public class ToolSlotSettings extends ArrayList<ToolSlot> {
|
||||
|
||||
public ToolSlotSettings(String slot1, String slot2, String slot3, String slot4, int slotsLocked) throws Exception {
|
||||
super.add(new ToolSlot(ToolType.valueOf(slot1), false));
|
||||
super.add(new ToolSlot(ToolType.valueOf(slot2), slotsLocked < 3));
|
||||
super.add(new ToolSlot(ToolType.valueOf(slot3), slotsLocked < 2));
|
||||
super.add(new ToolSlot(ToolType.valueOf(slot4), slotsLocked < 1));
|
||||
super.add(new ToolSlot(ToolType.valueOf(slot2), slotsLocked >= 3));
|
||||
super.add(new ToolSlot(ToolType.valueOf(slot3), slotsLocked >= 2));
|
||||
super.add(new ToolSlot(ToolType.valueOf(slot4), slotsLocked >= 1));
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
|
@ -9,10 +9,10 @@ public class User {
|
||||
public void onLvUp(int level);
|
||||
}
|
||||
|
||||
private final int LV_DONE_EP = 25;
|
||||
private final int STAR_EP = 4;
|
||||
private final int ENERGY_EP = 13;
|
||||
//MAX EP IN ONE LEVEL: 50 (25 + 3*4 + 13)
|
||||
private final int LV_DONE_EP = 20;
|
||||
private final int STAR_EP = 2;
|
||||
private final int ENERGY_EP = 10;
|
||||
//MAX EP IN ONE LEVEL: 36 (20 + 3*2 + 10)
|
||||
|
||||
private LvUpListener lvUpListener;
|
||||
private int ep;
|
||||
|
@ -94,6 +94,7 @@ public class TopBar extends TopBarData implements View.OnClickListener {
|
||||
dataStorageHandler.writeUserData(user);
|
||||
levelManager.reset();
|
||||
dataStorageHandler.clearLevelProgess();
|
||||
dataStorageHandler.clearLevelPackLocked();
|
||||
for (ToolType type : ToolType.values())
|
||||
type.setBought(false);
|
||||
dataStorageHandler.writeBoughtTools();
|
||||
|
BIN
app/src/main/res/drawable/tip_icon.png
Normal file
BIN
app/src/main/res/drawable/tip_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -3,13 +3,13 @@
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="20dp" />
|
||||
<padding
|
||||
android:bottom="9dp"
|
||||
android:left="9dp"
|
||||
android:right="9dp"
|
||||
android:top="9dp" />
|
||||
android:bottom="13dp"
|
||||
android:left="13dp"
|
||||
android:right="13dp"
|
||||
android:top="13dp" />
|
||||
<stroke
|
||||
android:width="5dp"
|
||||
android:color="#000000" />
|
||||
android:width="3dp"
|
||||
android:color="#d8000000" />
|
||||
<solid
|
||||
android:color="#ffffff"/>
|
||||
</shape>
|
@ -7,13 +7,15 @@
|
||||
android:id="@+id/startscreen_sound"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/startscreen_play"
|
||||
android:layout_marginTop="26dp"
|
||||
android:layout_toEndOf="@+id/startscreen_play"
|
||||
android:layout_toRightOf="@+id/startscreen_play"
|
||||
android:layout_marginTop="34dp"
|
||||
android:background="@drawable/xml_selector_sound"
|
||||
android:textOff=""
|
||||
android:textOn=""/>
|
||||
android:textOn=""
|
||||
android:layout_below="@+id/startscreen_play"
|
||||
android:layout_toRightOf="@+id/startscreen_play"
|
||||
android:layout_toEndOf="@+id/startscreen_play"
|
||||
android:layout_marginLeft="75dp"
|
||||
android:layout_marginStart="75dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/startscreen_play"
|
||||
@ -32,20 +34,23 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Level Up"
|
||||
android:layout_alignTop="@+id/startscreen_play"
|
||||
android:layout_toRightOf="@+id/startscreen_sound"
|
||||
android:layout_toEndOf="@+id/startscreen_sound"/>
|
||||
android:visibility="visible"
|
||||
android:layout_alignBottom="@+id/startscreen_play"
|
||||
android:layout_alignRight="@+id/startscreen_sound"
|
||||
android:layout_alignEnd="@+id/startscreen_sound"
|
||||
android:layout_marginBottom="26dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/startscreen_maxcheat"
|
||||
style="@style/GameButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lv to 100"
|
||||
android:layout_below="@+id/startscreen_play"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/startscreen_play"
|
||||
android:layout_marginLeft="48dp"
|
||||
android:layout_marginStart="48dp"/>
|
||||
android:layout_marginStart="48dp"
|
||||
android:text="Lv to 100"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</RelativeLayout>
|
@ -8,6 +8,12 @@
|
||||
layout="@layout/game"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/tutorial_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/tutorial_welcome"
|
||||
android:layout_width="match_parent"
|
||||
@ -24,7 +30,7 @@
|
||||
android:layout_marginEnd="56dp"
|
||||
android:layout_marginRight="56dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:text="Welcome to Endless Roll!\nThis is a test tutorial screen!\nHave fun!"/>
|
||||
android:text="Welcome to Endless Roll!\nHave fun!"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@ -37,24 +43,22 @@
|
||||
style="@style/TutorialTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/imageView3"
|
||||
android:layout_alignStart="@+id/imageView3"
|
||||
android:layout_alignTop="@+id/imageView3"
|
||||
android:layout_marginLeft="46dp"
|
||||
android:layout_marginStart="46dp"
|
||||
android:layout_marginTop="36dp"
|
||||
android:layout_marginTop="23dp"
|
||||
android:layout_toEndOf="@+id/imageView3"
|
||||
android:layout_toRightOf="@+id/imageView3"
|
||||
android:text="Here you can see your tools"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView3"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="170dp"
|
||||
android:layout_marginStart="170dp"
|
||||
android:layout_marginTop="79dp"
|
||||
android:layout_marginLeft="171dp"
|
||||
android:layout_marginStart="171dp"
|
||||
android:layout_marginTop="86dp"
|
||||
android:background="@drawable/guis_playerarrow"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@ -66,6 +70,7 @@
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
style="@style/TutorialTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -76,6 +81,18 @@
|
||||
android:layout_marginRight="104dp"
|
||||
android:layout_marginTop="105dp"
|
||||
android:text="Now place your ramp in front of the gap!"/>
|
||||
|
||||
<!--<ImageView-->
|
||||
<!--android:layout_width="40dp"-->
|
||||
<!--android:layout_height="40dp"-->
|
||||
<!--android:layout_alignParentBottom="true"-->
|
||||
<!--android:layout_alignParentEnd="true"-->
|
||||
<!--android:layout_alignParentRight="true"-->
|
||||
<!--android:layout_marginBottom="34dp"-->
|
||||
<!--android:layout_marginEnd="86dp"-->
|
||||
<!--android:layout_marginRight="86dp"-->
|
||||
<!--android:background="@drawable/tip_icon"/>-->
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@ -94,7 +111,38 @@
|
||||
android:layout_marginEnd="104dp"
|
||||
android:layout_marginRight="104dp"
|
||||
android:layout_marginTop="105dp"
|
||||
android:text="Now place it in front of the obstacle!"/>
|
||||
android:text="Now place it in front of the obstacle!"
|
||||
android:id="@+id/textView2"/>
|
||||
|
||||
<!--<ImageView-->
|
||||
<!--android:layout_width="40dp"-->
|
||||
<!--android:layout_height="40dp"-->
|
||||
<!--android:background="@drawable/tip_icon"-->
|
||||
<!--android:layout_marginRight="72dp"-->
|
||||
<!--android:layout_marginEnd="72dp"-->
|
||||
<!--android:layout_marginBottom="46dp"-->
|
||||
<!--android:layout_alignParentBottom="true"-->
|
||||
<!--android:layout_alignParentRight="true"-->
|
||||
<!--android:layout_alignParentEnd="true"/>-->
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/tutorial_ramp_in_air"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
style="@style/TutorialTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="You can even set a Tool in mid-air!"
|
||||
android:layout_marginLeft="43dp"
|
||||
android:layout_marginStart="43dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="88dp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
Reference in New Issue
Block a user