Skip to content

Commit 143656b

Browse files
committed
Bug fixing and tutorial improved.
1 parent afa006f commit 143656b

8 files changed

Lines changed: 55 additions & 22 deletions

File tree

core/src/com/renderwaves/ld49/entity/EntityManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public EntityManager() {
1616
}
1717

1818
PlayerEntity playerEntity;
19-
FireExtinguisher fireExtinguisher;
19+
public FireExtinguisher fireExtinguisher;
2020
public void handleEntities(SpriteBatch batch) {
2121
for (int i = 0; i < this.size(); i++) {
2222
get(i).update();

core/src/com/renderwaves/ld49/entity/entities/PlayerEntity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class PlayerEntity extends TexturedEntity {
4040
private boolean nearNavigation = false;
4141

4242
private boolean hasSpacesuit = false;
43-
private boolean hasFireExtinguisher = false;
43+
public boolean hasFireExtinguisher = false;
4444

4545
private boolean touchingFire = false;
4646

@@ -163,7 +163,6 @@ else if (currentUranium != null) {
163163
healthBar.renderSprite(spriteBatch);
164164

165165
if (touchingFire) {
166-
System.out.println(hasSpacesuit);
167166
if(!hasSpacesuit) health -= Gdx.graphics.getDeltaTime() / 5;
168167
}
169168

core/src/com/renderwaves/ld49/scenes/IntroScene.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.renderwaves.ld49.scenes;
22

33
import com.badlogic.gdx.Gdx;
4+
import com.badlogic.gdx.Input;
45
import com.badlogic.gdx.Screen;
56
import com.badlogic.gdx.graphics.GL20;
67
import com.badlogic.gdx.graphics.g2d.Sprite;
@@ -68,6 +69,10 @@ private void nextFrame(float delta){
6869

6970
@Override
7071
public void render(float delta) {
72+
if(Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)) {
73+
game.setScreen(new MenuScene(game));
74+
}
75+
7176
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
7277
nextFrame(delta);
7378
background.renderShape(shapeRenderer);

core/src/com/renderwaves/ld49/scenes/MenuScene.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.renderwaves.ld49.scenes;
22

33
import com.badlogic.gdx.Gdx;
4+
import com.badlogic.gdx.Input;
45
import com.badlogic.gdx.Screen;
56
import com.badlogic.gdx.graphics.Color;
67
import com.badlogic.gdx.graphics.GL20;
@@ -56,6 +57,8 @@ public MenuScene(Game game){
5657
spriteBatch = new SpriteBatch();
5758
shapeRenderer = new ShapeRenderer();
5859

60+
startingGame = false;
61+
5962
background = new Background();
6063
background.keepMoving = true;
6164

@@ -268,6 +271,10 @@ public void show() {
268271
private boolean toGame = false;
269272

270273
private void nextFrame(float delta){
274+
if(startingGame && Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)) {
275+
game.setScreen(new TutorialScene(game));
276+
}
277+
271278
time += delta;
272279
if(time > 0.1f){
273280
vidCurFrame++;
@@ -283,6 +290,7 @@ private void nextFrame(float delta){
283290
vidCurSprite.setScale(5,5);
284291
}
285292

293+
private boolean startingGame = false;
286294
private void callbackStartGame() {
287295
stage.clear();
288296
video.clear();
@@ -291,6 +299,7 @@ private void callbackStartGame() {
291299
video = videoAtlas.createSprites();
292300
vidCurFrame = 0;
293301
GlobalShipVariables.tutorialMode = false;
302+
startingGame = true;
294303
toGame = true;
295304
}
296305

@@ -303,6 +312,7 @@ private void callbackStartTutorial() {
303312
vidCurFrame = 0;
304313
TemplateScene.tutorialStage = 0;
305314
GlobalShipVariables.tutorialMode = true;
315+
startingGame = true;
306316
toGame = true;
307317
}
308318

core/src/com/renderwaves/ld49/scenes/TemplateScene.java

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static TemplateScene getInstance() {
6969
return instance;
7070
}
7171

72-
private Arrow arrow;
72+
public Arrow arrow;
7373

7474
/*
7575
*/
@@ -251,22 +251,38 @@ else if(tutorialStage == 13) {
251251
tempBool = false;
252252
}
253253
else if(tutorialStage == 14 && !tempBool) {
254+
if(!shipTilemap.player.hasFireExtinguisher) {
255+
arrow.position.x = entityManager.fireExtinguisher.position.x;
256+
arrow.position.y = Gdx.graphics.getHeight()-entityManager.fireExtinguisher.position.y-32;
257+
}
258+
else {
259+
tutorialStage++;
260+
}
261+
tutorialText = "PICK UP EXTINGUISHER.";
262+
glyphLayout.setText(FontManager.font_droidBb_40, tutorialText);
263+
}
264+
else if (tutorialStage == 15 && !tempBool) {
254265
boolean placeFire = true;
255266
while(placeFire) {
256267
Vector2 pos = new Vector2((int)((float)Math.random() * shipTilemap.getWidth()), (int)((float)Math.random() * shipTilemap.getHeight()));
257268
if(shipTilemap.getTileByPosition((int)pos.x, (int)pos.y).tileID == Tile.GroundTile.tileID) {
258-
shipTilemap.fireHandler.add(new Fire(new Vector2(pos.x*32+shipTilemap.offset.x-4, pos.y*32+shipTilemap.offset.y)));
269+
shipTilemap.fireHandler.add(new Fire(new Vector2(pos.x*32+shipTilemap.offset.x, pos.y*32+shipTilemap.offset.y)));
259270
placeFire = false;
271+
272+
if(shipTilemap.player.hasFireExtinguisher) {
273+
arrow.position.x = pos.x*32+shipTilemap.offset.x;
274+
arrow.position.y = Gdx.graphics.getHeight()-(pos.y*32+shipTilemap.offset.y+32);
275+
}
260276
}
261277
}
262-
arrow.position.x = -100;
263-
arrow.position.y = -100;
264-
tutorialText = "FIRE BROKE OUT. PICK UP EXTINGUISHER AND EXTINGUISH IT BY COMING NEAR IT.";
278+
tutorialText = "FIRE BROKE OUT. EXTINGUISH IT BY COMING NEAR IT.";
265279
glyphLayout.setText(FontManager.font_droidBb_40, tutorialText);
266280
tempBool = true;
267281
}
268-
else if(tutorialStage >= 15) {
282+
else if(tutorialStage >= 16) {
269283
tutorialText = "GOOD JOB! YOU FINISHED TUTORIAL. PRESS SPACE FOR MENU.";
284+
arrow.position.x = -100;
285+
arrow.position.y = -100;
270286
glyphLayout.setText(FontManager.font_droidBb_40, tutorialText);
271287
}
272288
return;
@@ -370,7 +386,7 @@ public void render(float delta) {
370386
}
371387
}
372388

373-
if(tutorialStage >= 15 && GlobalShipVariables.tutorialMode) {
389+
if(tutorialStage >= 16 && GlobalShipVariables.tutorialMode) {
374390
if(Gdx.input.isKeyJustPressed(Input.Keys.SPACE)) {
375391
TemplateScene.shipTilemap.doorHandler.clear();
376392
TemplateScene.shipTilemap.fireHandler.clear();

core/src/com/renderwaves/ld49/scenes/TutorialScene.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public TutorialScene(Game game) {
2626
@Override
2727
public void show() {
2828
Skin uiSkin = new Skin();
29-
uiSkin.add("default-font", FontManager.font_droidBb_20);
29+
uiSkin.add("default-font", FontManager.font_droidBb_40);
3030

3131
uiSkin.addRegions(new TextureAtlas(Gdx.files.internal("uiskin.atlas")));
3232
uiSkin.load(Gdx.files.internal("skins/skin.json"));
@@ -44,7 +44,7 @@ public void changed(ChangeEvent event, Actor actor) {
4444

4545
Table table = new Table();
4646
table.add(startGameButton).right().top();
47-
table.setPosition(Gdx.graphics.getWidth() - 55, Gdx.graphics.getHeight() - 20);
47+
table.setPosition(Gdx.graphics.getWidth() - 100, Gdx.graphics.getHeight() - 30);
4848

4949
stage.addActor(table);
5050
}

core/src/com/renderwaves/ld49/ui/CommunicationMenu.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ else if(difficulty == 1) {
7272
else if(difficulty == 4) {
7373
cooldown = 30;
7474
}
75+
76+
window.setVisible(false);
7577
}
7678
});
7779

@@ -102,6 +104,8 @@ else if(difficulty == 1) {
102104
else if(difficulty == 4) {
103105
cooldown = 20;
104106
}
107+
108+
window.setVisible(false);
105109
}
106110
});
107111

core/src/com/renderwaves/ld49/ui/WarningLabel.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,17 @@ public WarningLabel(int x, int y, String text, Color color1, Color color2, float
3434

3535
private boolean switchColors = false;
3636
public void render(SpriteBatch spriteBatch, float offsetY) {
37-
timer += Gdx.graphics.getRawDeltaTime();
37+
timer += Gdx.graphics.getDeltaTime();
3838
if (timer > time) {
39-
timer -= time;
40-
if (font != null)
41-
event();
39+
timer = 0;
40+
switchColors = !switchColors;
41+
System.out.println(switchColors);
4242
}
4343

44-
if (font != null) font.draw(spriteBatch, this.glyphLayout, ((float)Gdx.graphics.getWidth()/2) - (glyphLayout.width/2), this.y - (offsetY * 42));
45-
}
46-
47-
private void event() {
48-
font.setColor(switchColors ? color2 : color1);
49-
switchColors = !switchColors;
44+
if (font != null) {
45+
spriteBatch.setColor(switchColors ? color1 : color2);
46+
font.draw(spriteBatch, this.glyphLayout, ((float)Gdx.graphics.getWidth()/2) - (glyphLayout.width/2), this.y - (offsetY * 42));
47+
spriteBatch.setColor(Color.WHITE);
48+
}
5049
}
5150
}

0 commit comments

Comments
 (0)