Created
July 30, 2013 13:26
-
-
Save EFox2413/6112878 to your computer and use it in GitHub Desktop.
why no worky
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/main.ts b/main.ts | |
index 1778148..0cb906a 100644 | |
--- a/main.ts | |
+++ b/main.ts | |
@@ -327,6 +327,7 @@ function newSpellList() : Spell[] { | |
class Player extends Actor { | |
x : number = 0; | |
img : heart.HeartImage = null; | |
+ imgFlip : heart.HeartImage = null; | |
xp : number = 975; | |
upgradePoints : number = 1; | |
@@ -336,6 +337,7 @@ class Player extends Actor { | |
} | |
getImage() { return this.img } | |
+ getImageFlip() { return this.imgFlip } | |
damage(amount:number) { | |
super.damage(amount); | |
@@ -455,7 +457,7 @@ class PlayState implements GameState { | |
// go right | |
if(c == "right") { | |
turn(); | |
- heart.graphics.newImage("assets/player.png", function(r) { player.img = r; TILE_WIDTH = r.img.width; TILE_HEIGHT = r.img.height; }); | |
+ player.getImage(); | |
if(player.x+1 < map.width && !map.isSolidAt(player.x+1)) { | |
player.x++; | |
camera.center(player.x); | |
@@ -464,7 +466,7 @@ class PlayState implements GameState { | |
// go left | |
else if(c == "left") { | |
turn(); | |
- heart.graphics.newImage("assets/player_reversed.png", function(r) { player.img = r; TILE_WIDTH = r.img.width; TILE_HEIGHT = r.img.height; }); | |
+ player.getImageFlip(); | |
if(player.x-1 >= 0 && !map.isSolidAt(player.x-1)) { | |
player.x--; | |
camera.center(player.x); | |
@@ -567,6 +569,7 @@ var SCREEN_WIDTH, SCREEN_HEIGHT, TILE_WIDTH, TILE_HEIGHT; | |
heart.preload = function() { | |
heart.graphics.newImage("assets/player.png", function(r) { player.img = r; TILE_WIDTH = r.img.width; TILE_HEIGHT = r.img.height; }); | |
+ heart.graphics.newImage("assets/player_reversed.png", function(r) { player.imgFlip = r; }); | |
heart.graphics.newImage("assets/top.png", function(r) { tile_top = r; }); | |
heart.graphics.newImage("assets/wall3.png", function(r) { tile_wall = r; }); | |
heart.graphics.newImage("assets/ankh1.png", function(r) { tile_idk = r; }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment