save chao color, remove walk on command, tweak animation
@@ -107,7 +107,7 @@ function setupChaoAnimations (image)
107
107
image.addAnimationCycle("happy", [49, 50, 49, 51], true);
108
108
image.addAnimationCycle("standDownSad", [52], false);
109
109
image.addAnimationCycle("sleep", [53, 54], true);
110
image.addAnimationCycle("eureka", [60, 60, 60, 66, 66, 48], false, "wave");
110
image.addAnimationCycle("eureka", [60, 60, 60, 60, 60, 60, 60, 60, 60, 66, 66, 66, 66, 66, 66, 48, 48, 48], false, "wave");
111
111
112
112
image.addAnimationCycle("swim", [55, 56, 57], true);
113
113
image.addAnimationCycle("eatBig", [58, 59], true);
@@ -126,7 +126,7 @@ createMainScene = function (game)
126
126
game.loadScene(scene);
127
127
128
128
background.addObject(new GrassTiler(50, 50, game.images.arrow, 0));
129
chao = new Chao(60, 60, game.images.chao_default, 0);
129
chao = new Chao(Math.randomRange(0, 704), Math.randomRange(0, 640), game.images.chao_default, 0);
130
130
scene.addObject(chao);
131
131
132
132
scene.addObject(new MenuManager(0, 50, game.images.menuButton, 0));
@@ -107,7 +107,7 @@ function setupChaoAnimations (image)107
image.addAnimationCycle("happy", [49, 50, 49, 51], true);107
image.addAnimationCycle("happy", [49, 50, 49, 51], true);108
image.addAnimationCycle("standDownSad", [52], false);108
image.addAnimationCycle("standDownSad", [52], false);109
image.addAnimationCycle("sleep", [53, 54], true);109
image.addAnimationCycle("sleep", [53, 54], true);110
image.addAnimationCycle("eureka", [60, 60, 60, 66, 66, 48], false, "wave");110
image.addAnimationCycle("eureka", [60, 60, 60, 60, 60, 60, 60, 60, 60, 66, 66, 66, 66, 66, 66, 48, 48, 48], false, "wave");111
111
112
image.addAnimationCycle("swim", [55, 56, 57], true);112
image.addAnimationCycle("swim", [55, 56, 57], true);113
image.addAnimationCycle("eatBig", [58, 59], true);113
image.addAnimationCycle("eatBig", [58, 59], true);@@ -126,7 +126,7 @@ createMainScene = function (game)126
game.loadScene(scene);126
game.loadScene(scene);127
127
128
background.addObject(new GrassTiler(50, 50, game.images.arrow, 0));128
background.addObject(new GrassTiler(50, 50, game.images.arrow, 0));129
chao = new Chao(60, 60, game.images.chao_default, 0);129
chao = new Chao(Math.randomRange(0, 704), Math.randomRange(0, 640), game.images.chao_default, 0);130
scene.addObject(chao);130
scene.addObject(chao);131
131
132
scene.addObject(new MenuManager(0, 50, game.images.menuButton, 0));132
scene.addObject(new MenuManager(0, 50, game.images.menuButton, 0));@@ -59,7 +59,18 @@ class Chao extends GameObject
59
59
60
60
addedToScene ()
61
61
{
62
this.renderer.sprite = this.scene.game.chaoImages.random();
62
let savedSprite = CookieManager.getCookie("chaoType");
63
64
if (savedSprite.length <= 0)
65
{
66
this.renderer.sprite = this.scene.game.chaoImages.random();
67
}
68
else
69
{
70
this.renderer.sprite = game.images[savedSprite];
71
}
72
73
CookieManager.setCookie("chaoType", this.renderer.sprite.name);
63
74
64
75
this.renderer.defaultAnimationSpeed = 0.2;
65
76
this.registerBehaviour(new BehaviourEmote());
@@ -88,10 +99,6 @@ class Chao extends GameObject
88
99
update (deltaTime)
89
100
{
90
101
super.update(deltaTime);
91
if (GameInput.isPressed(GameInput.keys.a))
92
{
93
this.walkToPosition(GameInput.mousePosition.getCopy());
94
}
95
102
96
103
if (this.busyWithBehaviour)
97
104
this.currentBehaviour.update(deltaTime);
@@ -59,7 +59,18 @@ class Chao extends GameObject59
59
60
addedToScene ()60
addedToScene ()61
{61
{62
this.renderer.sprite = this.scene.game.chaoImages.random();62
let savedSprite = CookieManager.getCookie("chaoType");63
64
if (savedSprite.length <= 0)65
{66
this.renderer.sprite = this.scene.game.chaoImages.random();67
}68
else69
{70
this.renderer.sprite = game.images[savedSprite];71
}72
73
CookieManager.setCookie("chaoType", this.renderer.sprite.name);63
74
64
this.renderer.defaultAnimationSpeed = 0.2;75
this.renderer.defaultAnimationSpeed = 0.2;65
this.registerBehaviour(new BehaviourEmote());76
this.registerBehaviour(new BehaviourEmote());@@ -88,10 +99,6 @@ class Chao extends GameObject88
update (deltaTime)99
update (deltaTime)89
{100
{90
super.update(deltaTime);101
super.update(deltaTime);91
if (GameInput.isPressed(GameInput.keys.a))92
{93
this.walkToPosition(GameInput.mousePosition.getCopy());94
}95
102
96
if (this.busyWithBehaviour)103
if (this.busyWithBehaviour)97
this.currentBehaviour.update(deltaTime);104
this.currentBehaviour.update(deltaTime);