Permalink
Browse files

Show skyscraper instructions

  • Loading branch information...
1 parent f482dde commit 797025a16bd78e4559d75120a61cf2980f871ac0 @aardvarrk aardvarrk committed Feb 7, 2013
Showing with 2,796 additions and 2,282 deletions.
  1. BIN Game4.class
  2. +1 −1 Game4.java
  3. BIN Player.class
  4. BIN SkyscraperBrick.class
  5. +2 −0 SkyscraperBrick.ctxt
  6. +6 −0 SkyscraperBrick.java
  7. BIN SkyscraperCoin.class
  8. +1 −4 SkyscraperCoin.ctxt
  9. +1 −16 SkyscraperCoin.java
  10. BIN SkyscraperCounter.class
  11. +14 −0 SkyscraperCounter.ctxt
  12. +53 −0 SkyscraperCounter.java
  13. BIN SkyscraperGround.class
  14. +2 −0 SkyscraperGround.ctxt
  15. +6 −0 SkyscraperGround.java
  16. BIN SkyscraperLife.class
  17. +4 −0 SkyscraperLife.ctxt
  18. +8 −0 SkyscraperLife.java
  19. BIN SkyscraperLifesText.class
  20. +6 −0 SkyscraperLifesText.ctxt
  21. +27 −0 SkyscraperLifesText.java
  22. BIN SkyscraperMenuBar.class
  23. +4 −0 SkyscraperMenuBar.ctxt
  24. +8 −0 SkyscraperMenuBar.java
  25. BIN SkyscraperMovingBrickLeft.class
  26. +12 −0 SkyscraperMovingBrickLeft.ctxt
  27. +43 −0 SkyscraperMovingBrickLeft.java
  28. BIN SkyscraperMovingBrickRight.class
  29. +12 −0 SkyscraperMovingBrickRight.ctxt
  30. +37 −0 SkyscraperMovingBrickRight.java
  31. BIN SkyscraperMovingBrickUp.class
  32. +12 −0 SkyscraperMovingBrickUp.ctxt
  33. +43 −0 SkyscraperMovingBrickUp.java
  34. BIN SkyscraperMovingWater.class
  35. +10 −0 SkyscraperMovingWater.ctxt
  36. +32 −0 SkyscraperMovingWater.java
  37. BIN SkyscraperPlayer.class
  38. +20 −19 SkyscraperPlayer.java
  39. BIN SkyscraperSurface.class
  40. +2 −0 SkyscraperSurface.ctxt
  41. +6 −0 SkyscraperSurface.java
  42. BIN SkyscraperTimeCounter.class
  43. +16 −0 SkyscraperTimeCounter.ctxt
  44. +56 −0 SkyscraperTimeCounter.java
  45. BIN SkyscraperWorld.class
  46. +7 −5 SkyscraperWorld.ctxt
  47. +191 −122 SkyscraperWorld.java
  48. BIN SkyscraperWorldMenu.class
  49. +6 −0 SkyscraperWorldMenu.ctxt
  50. +18 −0 SkyscraperWorldMenu.java
  51. BIN images/gameOver_game4.png
  52. BIN images/life_image.png
  53. BIN images/skyscraper_menu.png
  54. +2,130 −2,115 project.greenfoot
View
Binary file not shown.
View
@@ -4,7 +4,7 @@
public void act() {
if (Greenfoot.mouseClicked(this)) {
Greenfoot.setSpeed(40);
- Greenfoot.setWorld(new SkyscraperWorld());
+ Greenfoot.setWorld(new SkyscraperWorldMenu());
}
}
}
View
Binary file not shown.
View
Binary file not shown.
@@ -0,0 +1,2 @@
+#BlueJ class context
+numComments=0
@@ -0,0 +1,6 @@
+import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
+
+public class SkyscraperBrick extends SkyscraperSurface
+{
+
+}
View
Binary file not shown.
View
@@ -1,7 +1,4 @@
#BlueJ class context
comment0.params=
comment0.target=SkyscraperCoin()
-comment0.text=\n\ Act\ -\ do\ whatever\ the\ Coin\ wants\ to\ do.\ This\ method\ is\ called\ whenever\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\n
-comment1.params=
-comment1.target=void\ act()
-numComments=2
+numComments=1
View
@@ -1,23 +1,8 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
-/**
- * Write a description of class Coin here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
public class SkyscraperCoin extends Actor
{
- /**
- * Act - do whatever the Coin wants to do. This method is called whenever
- * the 'Act' or 'Run' button gets pressed in the environment.
- */
-
public SkyscraperCoin(){
getImage().scale(30, 30);
- }
-
- public void act() {
-
- }
+ }
}
Binary file not shown.
@@ -0,0 +1,14 @@
+#BlueJ class context
+comment0.params=
+comment0.target=SkyscraperCounter()
+comment1.params=prefix
+comment1.target=SkyscraperCounter(java.lang.String)
+comment2.params=
+comment2.target=void\ act()
+comment3.params=score
+comment3.target=void\ add(int)
+comment4.params=
+comment4.target=int\ getValue()
+comment5.params=
+comment5.target=void\ updateImage()
+numComments=6
@@ -0,0 +1,53 @@
+import greenfoot.*;
+
+import java.awt.Color;
+import java.awt.Graphics;
+
+public class SkyscraperCounter extends Actor {
+ private static final Color textColor = new Color(255, 255, 255);
+
+ public int value = 0;
+ public int target = 0;
+ private String text;
+ private int stringLength;
+
+ public SkyscraperCounter() {
+ this("");
+ }
+
+ public SkyscraperCounter(String prefix) {
+ text = prefix;
+ stringLength = (text.length() + 2) * 10;
+
+ setImage(new GreenfootImage(stringLength, 16));
+ GreenfootImage image = getImage();
+ image.setColor(textColor);
+
+ updateImage();
+ }
+
+ public void act() {
+ if(value < target) {
+ value++;
+ updateImage();
+ }
+ else if(value > target) {
+ value--;
+ updateImage();
+ }
+ }
+
+ public void add(int score) {
+ target += score;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ private void updateImage() {
+ GreenfootImage image = getImage();
+ image.clear();
+ image.drawString(text + value, 1, 12);
+ }
+}
View
Binary file not shown.
@@ -0,0 +1,2 @@
+#BlueJ class context
+numComments=0
@@ -0,0 +1,6 @@
+import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
+
+public class SkyscraperGround extends SkyscraperSurface
+{
+
+}
View
Binary file not shown.
View
@@ -0,0 +1,4 @@
+#BlueJ class context
+comment0.params=
+comment0.target=SkyscraperLife()
+numComments=1
View
@@ -0,0 +1,8 @@
+import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
+
+public class SkyscraperLife extends Actor
+{
+ public SkyscraperLife(){
+ getImage().scale(40, 40);
+ }
+}
Binary file not shown.
@@ -0,0 +1,6 @@
+#BlueJ class context
+comment0.params=
+comment0.target=SkyscraperLifesText()
+comment1.params=prefix
+comment1.target=SkyscraperLifesText(java.lang.String)
+numComments=2
@@ -0,0 +1,27 @@
+import greenfoot.*;
+
+import java.awt.Color;
+import java.awt.Graphics;
+
+public class SkyscraperLifesText extends Actor {
+ private static final Color textColor = new Color(255, 255, 255);
+
+ public int value = 0;
+ public int target = 0;
+ private String text;
+ private int stringLength;
+
+ public SkyscraperLifesText() {
+ this("");
+ }
+
+ public SkyscraperLifesText(String prefix) {
+ text = prefix;
+ stringLength = (text.length() + 2) * 10;
+
+ setImage(new GreenfootImage(stringLength, 16));
+ GreenfootImage image = getImage();
+ image.setColor(textColor);
+ image.drawString(text, 1, 12);
+ }
+}
Binary file not shown.
@@ -0,0 +1,4 @@
+#BlueJ class context
+comment0.params=
+comment0.target=SkyscraperMenuBar()
+numComments=1
@@ -0,0 +1,8 @@
+import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
+
+public class SkyscraperMenuBar extends Actor
+{
+ public SkyscraperMenuBar(){
+ getImage();
+ }
+}
Binary file not shown.
@@ -0,0 +1,12 @@
+#BlueJ class context
+comment0.params=leftT\ rightT
+comment0.target=SkyscraperMovingBrickLeft(int,\ int)
+comment0.text=\n\ Move\ in\ the\ direction\ we\ are\ currently\ moving\ in.\ Turn\ if\ we\ reach\ a\ turning\ point.\n
+comment1.params=
+comment1.target=void\ act()
+comment2.params=
+comment2.target=boolean\ atTurningPoint()
+comment2.text=\n\ Test\ if\ we\ are\ at\ one\ of\ the\ turning\ points.\n
+comment3.params=
+comment3.target=int\ getMovingBrickLeftSpeed()
+numComments=4
@@ -0,0 +1,43 @@
+import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
+
+/**
+ * Write a description of class MovingBrick here.
+ *
+ * @author (your name)
+ * @version (a version number or a date)
+ */
+public class SkyscraperMovingBrickLeft extends SkyscraperSurface
+{
+ private int speed = -1;
+ private int leftTurn;
+ private int rightTurn;
+
+ /**
+ * Move in the direction we are currently moving in. Turn if we reach a turning point.
+ */
+ public SkyscraperMovingBrickLeft(int leftT, int rightT) {
+ leftTurn = leftT;
+ rightTurn = rightT;
+ }
+
+ public void act()
+ {
+ setLocation ( getX() + speed, getY() );
+
+ if (atTurningPoint()) {
+ speed = -speed;
+ }
+ }
+
+ /**
+ * Test if we are at one of the turning points.
+ */
+ public boolean atTurningPoint()
+ {
+ return (getX() <= leftTurn || getX() >= rightTurn);
+ }
+
+ public int getMovingBrickLeftSpeed(){
+ return speed;
+ }
+}
Binary file not shown.
@@ -0,0 +1,12 @@
+#BlueJ class context
+comment0.params=leftT\ rightT
+comment0.target=SkyscraperMovingBrickRight(int,\ int)
+comment0.text=\n\ Move\ in\ the\ direction\ we\ are\ currently\ moving\ in.\ Turn\ if\ we\ reach\ a\ turning\ point.\n
+comment1.params=
+comment1.target=void\ act()
+comment2.params=
+comment2.target=boolean\ atTurningPoint()
+comment2.text=\n\ Test\ if\ we\ are\ at\ one\ of\ the\ turning\ points.\n
+comment3.params=
+comment3.target=int\ getMovingBrickRightSpeed()
+numComments=4
@@ -0,0 +1,37 @@
+import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
+
+public class SkyscraperMovingBrickRight extends SkyscraperSurface
+{
+ private int speed = 1;
+ private int leftTurn;
+ private int rightTurn;
+
+ /**
+ * Move in the direction we are currently moving in. Turn if we reach a turning point.
+ */
+ public SkyscraperMovingBrickRight(int leftT, int rightT) {
+ leftTurn = leftT;
+ rightTurn = rightT;
+ }
+
+ public void act()
+ {
+ setLocation ( getX() + speed, getY() );
+
+ if (atTurningPoint()) {
+ speed = -speed;
+ }
+ }
+
+ /**
+ * Test if we are at one of the turning points.
+ */
+ public boolean atTurningPoint()
+ {
+ return (getX() <= leftTurn || getX() >= rightTurn);
+ }
+
+ public int getMovingBrickRightSpeed(){
+ return speed;
+ }
+}
Binary file not shown.
@@ -0,0 +1,12 @@
+#BlueJ class context
+comment0.params=topT\ bottomT
+comment0.target=SkyscraperMovingBrickUp(int,\ int)
+comment0.text=\n\ Move\ in\ the\ direction\ we\ are\ currently\ moving\ in.\ Turn\ if\ we\ reach\ a\ turning\ point.\n
+comment1.params=
+comment1.target=void\ act()
+comment2.params=
+comment2.target=boolean\ atTurningPoint()
+comment2.text=\n\ Test\ if\ we\ are\ at\ one\ of\ the\ turning\ points.\n
+comment3.params=
+comment3.target=int\ getMovingBrickUpSpeed()
+numComments=4
@@ -0,0 +1,43 @@
+import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
+
+/**
+ * Write a description of class MovingBrick here.
+ *
+ * @author (your name)
+ * @version (a version number or a date)
+ */
+public class SkyscraperMovingBrickUp extends SkyscraperSurface
+{
+ private int speed = 1;
+ private int topTurn;
+ private int bottomTurn;
+
+ /**
+ * Move in the direction we are currently moving in. Turn if we reach a turning point.
+ */
+ public SkyscraperMovingBrickUp(int topT, int bottomT) {
+ topTurn = topT;
+ bottomTurn = bottomT;
+ }
+
+ public void act()
+ {
+ setLocation ( getX(), getY()+ speed );
+
+ if (atTurningPoint()) {
+ speed = -speed;
+ }
+ }
+
+ /**
+ * Test if we are at one of the turning points.
+ */
+ public boolean atTurningPoint()
+ {
+ return (getY() <= topTurn || getY() >= bottomTurn);
+ }
+
+ public int getMovingBrickUpSpeed(){
+ return speed;
+ }
+}
Binary file not shown.
@@ -0,0 +1,10 @@
+#BlueJ class context
+comment0.params=
+comment0.target=SkyscraperMovingWater()
+comment1.params=
+comment1.target=void\ act()
+comment2.params=
+comment2.target=int\ getLevel()
+comment3.params=lvl
+comment3.target=void\ setLevel(int)
+numComments=4
Oops, something went wrong.

0 comments on commit 797025a

Please sign in to comment.