Skip to content

Commit

Permalink
Commented StairsTile.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Davideesk committed Jul 23, 2013
1 parent 812fcf6 commit acd1bc8
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/com/mojang/ld22/level/tile/StairsTile.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
import com.mojang.ld22.level.Level;

public class StairsTile extends Tile {
private boolean leadsUp;
private boolean leadsUp; // value to tell if the stairs lead up or not

public StairsTile(int id, boolean leadsUp) {
super(id);
this.leadsUp = leadsUp;
super(id); // assigns the id
this.leadsUp = leadsUp; // assigns the leadsUp value
}

/** Render method, draws sprites on the screen */
public void render(Screen screen, Level level, int x, int y) {
int color = Color.get(level.dirtColor, 000, 333, 444);
int xt = 0;
if (leadsUp) xt = 2;
screen.render(x * 16 + 0, y * 16 + 0, xt + 2 * 32, color, 0);
screen.render(x * 16 + 8, y * 16 + 0, xt + 1 + 2 * 32, color, 0);
screen.render(x * 16 + 0, y * 16 + 8, xt + 3 * 32, color, 0);
screen.render(x * 16 + 8, y * 16 + 8, xt + 1 + 3 * 32, color, 0);
int color = Color.get(level.dirtColor, 000, 333, 444); // the color of the stairs
int xt = 0; // the x tile position on the tile sheet
if (leadsUp) xt = 2; // if the stairs lead up, then move the x tile position over 2 times
screen.render(x * 16 + 0, y * 16 + 0, xt + 2 * 32, color, 0); // renders the top left part of the sprite
screen.render(x * 16 + 8, y * 16 + 0, xt + 1 + 2 * 32, color, 0); // renders the top right part of the sprite
screen.render(x * 16 + 0, y * 16 + 8, xt + 3 * 32, color, 0); // renders the bottom left part of the sprite
screen.render(x * 16 + 8, y * 16 + 8, xt + 1 + 3 * 32, color, 0); // renders the bottoms right part of the sprite
}
}

0 comments on commit acd1bc8

Please sign in to comment.