Skip to content

Commit

Permalink
some polish
Browse files Browse the repository at this point in the history
  • Loading branch information
asalga committed Nov 27, 2013
1 parent b9728ad commit 850d81e
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 18 deletions.
12 changes: 10 additions & 2 deletions ScreenGameplay.pde
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public class ScreenGameplay implements IScreen, Subject{

int score = 0;

private float opacity = 0.0;

/**
*/
public void addObserver(LayerObserver o){
Expand Down Expand Up @@ -119,6 +121,12 @@ public class ScreenGameplay implements IScreen, Subject{
public void draw(){

background(0);

tint(opacity);
opacity += 1.0f;
if(opacity > 255){
opacity = 255;
}

pushMatrix();
translate(START_X, START_Y);
Expand Down Expand Up @@ -269,7 +277,7 @@ public class ScreenGameplay implements IScreen, Subject{
swapToken1.setReturning(true);
swapToken2.setReturning(true);

//soundManager.playFailSwapSound();
soundManager.playFailSwapSound();
}
// Swap was valid
else{
Expand Down Expand Up @@ -575,7 +583,7 @@ public class ScreenGameplay implements IScreen, Subject{
void keyReleased(){
Keyboard.setKeyDown(keyCode, false);

//soundManager.setMute(!soundManager.isMuted());
soundManager.setMute(!soundManager.isMuted());

isPaused = Keyboard.isKeyDown(KEY_P);
if(isPaused == false){
Expand Down
56 changes: 41 additions & 15 deletions ScreenStory.pde
Original file line number Diff line number Diff line change
@@ -1,46 +1,72 @@
/*
*/
public class ScreenStory implements IScreen{

public void OnTransitionTo(){
}

private int storyPointer = 0;

RetroFont solarWindsFont;
private RetroFont solarWindsFont;

private RetroLabel storyLabel;
private RetroLabel continueInstruction;

RetroLabel storyLabel;
RetroLabel continueInstruction;
private float textPos = 0;
private float easing = 0.08;
private boolean clicked = false;

private float target;

public ScreenStory(){
solarWindsFont = new RetroFont("data/fonts/solarwinds.png", 14, 16, 2);

storyLabel = new RetroLabel(solarWindsFont);
//storyLabel.setText(story[storyPointer]);
storyLabel.pixelsFromCenter(0, 0);

storyLabel.setDebug(false);

continueInstruction = new RetroLabel(solarWindsFont);
continueInstruction.setText("Click to continue");
continueInstruction.pixelsFromCenter(0, 50);
//continueInstruction = new RetroLabel(solarWindsFont);
//continueInstruction.setText("Click to continue");
}

public void draw(){
background(0);
storyLabel.draw();
continueInstruction.draw();
//continueInstruction.draw();
}

public void update(){


if(clicked == false){
textPos += (target - textPos) * easing;
}
else{
textPos += textPos * easing;
}

storyLabel.pixelsFromCenter(0, (int)textPos);

if(storyLabel.getY() > height + 30){
screens.transitionTo("gameplay");
}
}

public void OnTransitionTo(){
textPos = -(height/2) + 20;// bit of fudge
target = 0;// bit of fudge
clicked = false;
}

// Mouse methods
public void mousePressed(){}
public void mouseReleased(){
// if(storyPointer <= NUM_LEVELS){
screens.transitionTo("gameplay");
// }

// Can only reset the target position once.
if(clicked == true){
return;
}

clicked = true;
target = 300;
textPos = 0.1;
}
public void mouseDragged(){}
public void mouseMoved(){}
Expand Down
3 changes: 2 additions & 1 deletion SoundManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ function SoundManager(){

var BASE_PATH = "data/audio/";

var paths = [BASE_PATH + "fail_swap.ogg", BASE_PATH + "success_swap.ogg"];
var paths = [ BASE_PATH + "fail_swap.ogg",
BASE_PATH + "success_swap.ogg"];
var sounds = [];

var FAIL = 0;
Expand Down

0 comments on commit 850d81e

Please sign in to comment.