All upgrades are used in calculations -> bomb still has to be balanced

added firework on goal and different goal screen (with button to toolshop), but not happy with second one
Have to change it in layout file

TopBarData has been removed -> All data (DataStorageHandler, TutorialManager, LevelManager, SoundManager, Typeface, User) is stored in the GameActivity and can be recieved by getters

Toolshop-tutorial can now be reset and works instantaniously
This commit is contained in:
=
2017-07-18 15:57:21 +02:00
parent 4b4d81d8c7
commit b8322c9f05
28 changed files with 7590 additions and 2572 deletions

View File

@ -0,0 +1,160 @@
Untitled
- Delay -
active: false
- Duration -
lowMin: 100.0
lowMax: 100.0
- Count -
min: 0
max: 10000
- Emission -
lowMin: 0.0
lowMax: 0.0
highMin: 1000.0
highMax: 1000.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Life -
lowMin: 0.0
lowMax: 0.0
highMin: 2000.0
highMax: 2000.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Life Offset -
active: false
- X Offset -
active: false
- Y Offset -
active: false
- Spawn Shape -
shape: point
- Spawn Width -
lowMin: 0.0
lowMax: 0.0
highMin: 100.0
highMax: 100.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Spawn Height -
lowMin: 0.0
lowMax: 0.0
highMin: 50.0
highMax: 50.0
relative: false
scalingCount: 1
scaling0: 1.0
timelineCount: 1
timeline0: 0.0
- Scale -
lowMin: 10.0
lowMax: 15.0
highMin: 15.0
highMax: 45.0
relative: false
scalingCount: 3
scaling0: 0.0
scaling1: 0.0
scaling2: 1.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.28767124
timeline2: 1.0
- Velocity -
active: true
lowMin: 0.0
lowMax: 300.0
highMin: 800.0
highMax: 800.0
relative: false
scalingCount: 3
scaling0: 1.0
scaling1: 1.0
scaling2: 0.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.29791272
timeline2: 0.2989127
- Angle -
active: true
lowMin: 89.0
lowMax: 91.0
highMin: 0.0
highMax: 360.0
relative: false
scalingCount: 3
scaling0: 0.0
scaling1: 0.0
scaling2: 1.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.30260533
timeline2: 0.30360532
- Rotation -
active: false
- Wind -
active: false
- Gravity -
active: true
lowMin: 0.0
lowMax: 0.0
highMin: -50.0
highMax: -100.0
relative: false
scalingCount: 4
scaling0: 0.0
scaling1: 0.0
scaling2: 0.5294118
scaling3: 1.0
timelineCount: 4
timeline0: 0.0
timeline1: 0.29981026
timeline2: 0.65753424
timeline3: 0.75342464
- Tint -
colorsCount: 9
colors0: 0.0
colors1: 0.4
colors2: 1.0
colors3: 1.0
colors4: 0.0
colors5: 0.0
colors6: 1.0
colors7: 1.0
colors8: 1.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.35800344
timeline2: 1.0
- Transparency -
lowMin: 0.0
lowMax: 0.0
highMin: 1.0
highMax: 1.0
relative: false
scalingCount: 3
scaling0: 1.0
scaling1: 1.0
scaling2: 0.0
timelineCount: 3
timeline0: 0.0
timeline1: 0.70547944
timeline2: 1.0
- Options -
attached: false
continuous: false
aligned: false
additive: true
behind: false
premultipliedAlpha: false
- Image Path -
particle.png

View File

@ -2,12 +2,24 @@ precision mediump float;
uniform sampler2D texture;
uniform vec3 color;
uniform float alpha;
varying vec2 pass_TexCoords;
vec3 saturateColor(in vec3 color, in float a);
void main() {
gl_FragColor.a = texture2D(texture, pass_TexCoords).a;
gl_FragColor.rgb = color;
float a = texture2D(texture, pass_TexCoords).a * alpha;
gl_FragColor = vec4(saturateColor(color, a), a);
}
vec3 saturateColor(in vec3 color, in float a){
float grayscale = (color.r * 0.299 + color.g * 0.587 + color. b * 0.114);
float alpha = ((1.1 - a) * 0.5) * 40.0;
return alpha * color + (1.0 - alpha) * vec3(grayscale, grayscale, grayscale);
}

View File

@ -0,0 +1,53 @@
package de.frajul.endlessroll.entities.particles;
import java.util.Random;
import de.frajul.endlessroll.data.Vector;
import de.frajul.endlessroll.entities.particles.Particle;
import de.frajul.endlessroll.entities.particles.ParticleEffect;
import de.frajul.endlessroll.entities.particles.ParticleSource;
import de.frajul.endlessroll.main.game.Camera;
/**
* Created by Julian on 15.07.2017.
*/
public class Firework {
private ParticleEffect effect;
private Camera camera;
private Random random;
public Firework(ParticleEffect effect, Camera camera){
this.effect = effect;
this.camera = camera;
this.random = new Random();
}
public void start(){
randomExplosion(500);
randomExplosion(1000);
randomExplosion(2000);
randomExplosion(3500);
randomExplosion(3590);
randomExplosion(4800);
randomExplosion(5600);
randomExplosion(6900);
randomExplosion(7000);
}
private void randomExplosion(float delay){
ParticleSource explosion = new ParticleSource(randomPosition(), effect);
explosion.setDelayMS(delay);
explosion.start();
}
private Vector randomPosition(){
float x = camera.getX() + (random.nextFloat() - 0.5f) * 2.5f;
float y = camera.getY() + (random.nextFloat() * 0.5f) - 1f;
return new Vector(x, y);
}
}

View File

@ -0,0 +1,27 @@
package de.frajul.endlessroll.main.screens;
import android.widget.RelativeLayout;
import de.frajul.endlessroll.R;
import de.frajul.endlessroll.main.GameActivity;
/**
* Created by Julian on 15.07.2017.
*/
public class PreStartScreen extends Screen<RelativeLayout> {
public PreStartScreen(GameActivity gameActivity) {
super(ScreenType.PRE_START, gameActivity, R.layout.pre_start_screen);
}
@Override
public void prepareToBeShown() {
}
@Override
public void onBackKeyDown() {
}
}

View File

@ -0,0 +1,61 @@
package de.frajul.endlessroll.main.tutorial;
import java.util.ArrayList;
import java.util.List;
import de.frajul.endlessroll.R;
import de.frajul.endlessroll.entities.tools.ToolType;
/**
* Created by Julian on 10.06.2017.
*/
public class ToolShopTutorial extends Tutorial {
private List<BreakPoint> atStartBreakPoints = new ArrayList<>();
private List<BreakPoint> afterSpringBoughtBreakPoints = new ArrayList<>();
private boolean firstPartShown;
public ToolShopTutorial() {
super(-1, -1, new BreakPoint(0, R.id.tutorial_toolshop_welcome),
new BreakPoint(0, R.id.tutorial_toolshop_all_tools_and_inspector),
new BreakPoint(0, R.id.tutorial_toolshop_buy_spring),
new BreakPoint(1, R.id.tutorial_toolshop_equip_spring));
for (BreakPoint breakPoint : super.getBreakPoints()) {
if (breakPoint.getX() == 0)
atStartBreakPoints.add(breakPoint);
else
afterSpringBoughtBreakPoints.add(breakPoint);
}
}
@Override
public void reset() {
currentBreakPoints.clear();
firstPartShown = false;
}
public void onToolShopPrepare(boolean isSpringUnlocked) {
currentBreakPoints.clear();
if (isSpringUnlocked && !firstPartShown) {
currentBreakPoints.addAll(atStartBreakPoints);
firstPartShown = true;
}
}
public void onToolBought(ToolType type) {
currentBreakPoints.clear();
if (type == ToolType.SPRING) {
currentBreakPoints = afterSpringBoughtBreakPoints;
}
}
public boolean isFirstPartShown() {
return firstPartShown;
}
public void setFirstPartShown(boolean firstPartShown) {
this.firstPartShown = firstPartShown;
}
}

View File

@ -1,6 +1,5 @@
package de.frajul.endlessroll.views;
import android.content.Context;
import android.graphics.Typeface;
import android.view.View;
import android.widget.ImageView;
@ -8,8 +7,8 @@ import android.widget.TextView;
import de.frajul.endlessroll.R;
import de.frajul.endlessroll.entities.tools.ToolType;
import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.screens.ToolShopScreen;
import de.frajul.endlessroll.user.User;
/**
* Created by Julian on 03.06.2017.
@ -17,9 +16,8 @@ import de.frajul.endlessroll.user.User;
public class ToolInspector implements View.OnClickListener {
private GameActivity gameActivity;
private ToolShopScreen toolShopScreen;
private User user;
private Context context;
private TextView title;
private ImageView imageView;
@ -31,18 +29,18 @@ public class ToolInspector implements View.OnClickListener {
private ToolType toolType;
private boolean locked;
public ToolInspector(ToolShopScreen toolShopScreen, User user, Context context, Typeface typeface, View layout) {
public ToolInspector(ToolShopScreen toolShopScreen, GameActivity gameActivity, View layout) {
this.toolShopScreen = toolShopScreen;
this.user = user;
this.context = context;
this.gameActivity = gameActivity;
Typeface typeface = gameActivity.getTypeface();
title = (TextView) layout.findViewById(R.id.tool_inspector_title);
title.setTypeface(typeface);
imageView = (ImageView) layout.findViewById(R.id.tool_inspector_imageview);
priceButton = new PriceButton(context, typeface,
priceButton = new PriceButton(gameActivity, typeface,
layout.findViewById(R.id.tool_inspector_pricebutton), this);
toolUpgradeView0 = new ToolUpgradeView(this, context, typeface,
toolUpgradeView0 = new ToolUpgradeView(this, gameActivity, typeface,
layout.findViewById(R.id.tool_inspector_toolupgrade0));
toolUpgradeView1 = new ToolUpgradeView(this, context, typeface,
toolUpgradeView1 = new ToolUpgradeView(this, gameActivity, typeface,
layout.findViewById(R.id.tool_inspector_toolupgrade1));
}
@ -50,22 +48,22 @@ public class ToolInspector implements View.OnClickListener {
this.toolType = toolType;
this.locked = locked;
this.title.setText(locked ? "???" : toolType.getName());
this.imageView.setImageDrawable(context.getResources().getDrawable(
this.imageView.setImageDrawable(gameActivity.getResources().getDrawable(
locked ? R.drawable.tools_lockedbutton : toolType.getButtonDrawable()));
priceButton.init("Buy", toolType.getPrice(), R.drawable.currency_star);
priceButton.setLayoutVisible(toolType.isBought() || locked ? View.GONE : View.VISIBLE);
priceButton.setLayoutEnabled(toolType.getPrice() <= user.getStarCount());
priceButton.setLayoutEnabled(toolType.getPrice() <= gameActivity.getUser().getStarCount());
toolUpgradeView0
.update(toolType.getUpgrades()[0], toolType.isBought(), user.getEnergyCount());
toolUpgradeView0.update(toolType.getUpgrades()[0], toolType.isBought(),
gameActivity.getUser().getEnergyCount());
toolUpgradeView0.setLayoutVisiblity(locked ? View.GONE : View.VISIBLE);
if (toolType.getUpgrades().length <= 1 || locked)
toolUpgradeView1.setLayoutVisiblity(View.GONE);
else {
toolUpgradeView1.setLayoutVisiblity(View.VISIBLE);
toolUpgradeView1
.update(toolType.getUpgrades()[1], toolType.isBought(), user.getEnergyCount());
toolUpgradeView1.update(toolType.getUpgrades()[1], toolType.isBought(),
gameActivity.getUser().getEnergyCount());
}
}
@ -78,6 +76,6 @@ public class ToolInspector implements View.OnClickListener {
public void onClick(View v) {
toolType.setBought(true);
update(toolType, locked);
toolShopScreen.onToolBought(toolType.getPrice());
toolShopScreen.onToolBought(toolType.getPrice(), toolType);
}
}

View File

@ -13,33 +13,51 @@
android:textSize="55sp"/>
<Button
android:id="@+id/message_nextlevelbutton"
style="@style/GameButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Restart"
android:id="@+id/message_leftbutton"
style="@style/GameButton"
android:layout_marginTop="37dp"
android:layout_below="@+id/message_title"
android:layout_alignStart="@+id/message_title"/>
android:layout_toLeftOf="@+id/message_title"
android:layout_toStartOf="@+id/message_title"
android:text="Next level"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Exit"
style="@style/GameButton"
android:id="@+id/message_exitbutton"
android:layout_alignTop="@+id/message_leftbutton"
android:layout_alignEnd="@+id/message_title"/>
<Button
style="@style/GameButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Try again"
android:text="To menu"
android:layout_alignBaseline="@+id/message_restartbutton"
android:layout_alignBottom="@+id/message_restartbutton"
android:layout_alignLeft="@+id/message_toolshopbutton"
android:layout_alignStart="@+id/message_toolshopbutton"/>
<Button
android:id="@+id/message_toolshopbutton"
style="@style/GameButton"
android:id="@+id/message_tryagainbutton"
android:visibility="visible"
android:layout_marginTop="3dp"
android:layout_below="@+id/message_leftbutton"
android:layout_alignStart="@+id/message_leftbutton"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="21dp"
android:layout_marginStart="21dp"
android:text="Tools"
android:layout_above="@+id/message_title"
android:layout_toRightOf="@+id/message_title"
android:layout_toEndOf="@+id/message_title"
android:layout_marginBottom="14dp"/>
<Button
android:id="@+id/message_restartbutton"
style="@style/GameButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/message_title"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/message_title"
android:layout_marginBottom="14dp"
android:layout_marginLeft="50dp"
android:layout_marginStart="50dp"
android:text="Restart level"
android:visibility="visible"/>
</RelativeLayout>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00ef78">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="LOADING"
android:textAllCaps="false"
android:textSize="30sp"
android:textStyle="bold"/>
</RelativeLayout>

View File

@ -195,4 +195,102 @@
android:text="Now go to the toolshop"/>
</RelativeLayout>
<!--Toolshop welcome-->
<RelativeLayout
android:id="@+id/tutorial_toolshop_welcome"
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:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="34dp"
android:layout_marginStart="34dp"
android:layout_marginTop="111dp"
android:text="Welcome to the toolshop!"/>
</RelativeLayout>
<!--Toolshop all tools and inspector-->
<RelativeLayout
android:id="@+id/tutorial_toolshop_all_tools_and_inspector"
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:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="34dp"
android:layout_marginStart="34dp"
android:layout_marginTop="111dp"
android:text="Here you can see all the tools you'll be able to buy"/>
<TextView
style="@style/TutorialTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="Here you can buy and upgrade the selected tool"/>
</RelativeLayout>
<!--Toolshop buy spring-->
<RelativeLayout
android:id="@+id/tutorial_toolshop_buy_spring"
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:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="34dp"
android:layout_marginStart="34dp"
android:layout_marginTop="111dp"
android:text="Now select the spring and buy it"/>
</RelativeLayout>
<!--Toolshop equip spring-->
<RelativeLayout
android:id="@+id/tutorial_toolshop_equip_spring"
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:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="34dp"
android:layout_marginStart="34dp"
android:layout_marginTop="111dp"
android:text="Now tip on an unlocked slot of your toolbar to equip the spring"/>
<TextView
style="@style/TutorialTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="After that you'll be able to complete the next level"/>
</RelativeLayout>
</RelativeLayout>

View File

@ -9,6 +9,7 @@
<color name="toolbuttonActiveReady">#db41e42b</color>
<color name="toolbuttonLocked">#db494b49</color>
<color name="toolslotDisabled">#715f5f</color>
<color name="toolslotDisabledSelected">#60715f</color>
<color name="toolslotEnabled">#db41e42b</color>
<color name="toolslotEnabledSelected">#b3d700</color>
<color name="countdown3">#f0f41e02</color>