BlueGit

blue-star speeltuin

commit

timfa wsadhelios · pushed by timfa

Authored 2022-10-20 · 4 years ago

Hash
7afb425e6bba504718762dfc05ea1670c07027ab
Parent
affdc9b8
1 file changed +98 −100
src/game.js +98 −100
@@ -2,133 +2,131 @@ console.log("Game started!");
2 2 var game = new Game();
3 3 game.chaoImages = [];
4 4
5 window.onload = function()
5 window.onload = function ()
6 6 {
7 7
8 8 game.preloadImagesThenStart(
9 9 [
10 {name:"arrow", url:"images/arrow.png", subImgTotal: 4, perRow: 2},
11 {name:"gem", url:"images/gems.png", subImgTotal: 72, perRow: 6},
12 {name:"ball", url:"images/ball.png", subImgTotal: 4, perRow: 4},
13 {name:"grass_dark", url:"images/grass_dark.png"},
14 {name:"grass_light", url:"images/grass_light.png"},
15 {name:"frog_basic", url:"images/character/frog/frog_basic.png", subImgTotal: 4, perRow: 4},
16 {name:"frog_tongue_base", url:"images/character/frog/frog_tongue_base.png"},
17 {name:"frog_tongue_tip", url:"images/character/frog/frog_tongue_tip.png"},
18 {name:"chao_default", url:"images/character/chao/default.png", subImgTotal: 67, perRow: 9},
19 {name:"chao_blue", url:"images/character/chao/blue.png", subImgTotal: 67, perRow: 9},
20 {name:"chao_cyan", url:"images/character/chao/cyan.png", subImgTotal: 67, perRow: 9},
21 {name:"chao_dark", url:"images/character/chao/dark.png", subImgTotal: 67, perRow: 9},
22 {name:"chao_darkgreen", url:"images/character/chao/darkgreen.png", subImgTotal: 67, perRow: 9},
23 {name:"chao_green", url:"images/character/chao/green.png", subImgTotal: 67, perRow: 9},
24 {name:"chao_lightgreen", url:"images/character/chao/lightgreen.png", subImgTotal: 67, perRow: 9},
25 {name:"chao_hero", url:"images/character/chao/hero.png", subImgTotal: 67, perRow: 9},
26 {name:"chao_orange", url:"images/character/chao/orange.png", subImgTotal: 67, perRow: 9},
27 {name:"chao_pink", url:"images/character/chao/pink.png", subImgTotal: 67, perRow: 9},
28 {name:"chao_purple", url:"images/character/chao/purple.png", subImgTotal: 67, perRow: 9},
29 {name:"chao_red", url:"images/character/chao/red.png", subImgTotal: 67, perRow: 9},
30 {name:"chao_white", url:"images/character/chao/white.png", subImgTotal: 67, perRow: 9},
31 {name:"chao_yellow", url:"images/character/chao/yellow.png", subImgTotal: 67, perRow: 9},
32 {name:"tile_floor_brown", url:"images/tile/tile_floor_brown.png"},
33 {name:"tile_floor_explosion", url:"images/tile/tile_floor_explosion_anim.png", subImgTotal:10, perRow:5},
34 {name:"fruit", url:"images/object/fruit.png", subImgTotal: 15, perRow: 8}
10 { name: "arrow", url: "images/arrow.png", subImgTotal: 4, perRow: 2 },
11 { name: "gem", url: "images/gems.png", subImgTotal: 72, perRow: 6 },
12 { name: "ball", url: "images/ball.png", subImgTotal: 4, perRow: 4 },
13 { name: "grass_dark", url: "images/grass_dark.png" },
14 { name: "grass_light", url: "images/grass_light.png" },
15 { name: "frog_basic", url: "images/character/frog/frog_basic.png", subImgTotal: 4, perRow: 4 },
16 { name: "frog_tongue_base", url: "images/character/frog/frog_tongue_base.png" },
17 { name: "frog_tongue_tip", url: "images/character/frog/frog_tongue_tip.png" },
18 { name: "chao_default", url: "images/character/chao/default.png", subImgTotal: 67, perRow: 9 },
19 { name: "chao_blue", url: "images/character/chao/blue.png", subImgTotal: 67, perRow: 9 },
20 { name: "chao_cyan", url: "images/character/chao/cyan.png", subImgTotal: 67, perRow: 9 },
21 { name: "chao_dark", url: "images/character/chao/dark.png", subImgTotal: 67, perRow: 9 },
22 { name: "chao_darkgreen", url: "images/character/chao/darkgreen.png", subImgTotal: 67, perRow: 9 },
23 { name: "chao_green", url: "images/character/chao/green.png", subImgTotal: 67, perRow: 9 },
24 { name: "chao_lightgreen", url: "images/character/chao/lightgreen.png", subImgTotal: 67, perRow: 9 },
25 { name: "chao_hero", url: "images/character/chao/hero.png", subImgTotal: 67, perRow: 9 },
26 { name: "chao_orange", url: "images/character/chao/orange.png", subImgTotal: 67, perRow: 9 },
27 { name: "chao_pink", url: "images/character/chao/pink.png", subImgTotal: 67, perRow: 9 },
28 { name: "chao_purple", url: "images/character/chao/purple.png", subImgTotal: 67, perRow: 9 },
29 { name: "chao_red", url: "images/character/chao/red.png", subImgTotal: 67, perRow: 9 },
30 { name: "chao_white", url: "images/character/chao/white.png", subImgTotal: 67, perRow: 9 },
31 { name: "chao_yellow", url: "images/character/chao/yellow.png", subImgTotal: 67, perRow: 9 },
32 { name: "tile_floor_brown", url: "images/tile/tile_floor_brown.png" },
33 { name: "tile_floor_explosion", url: "images/tile/tile_floor_explosion_anim.png", subImgTotal: 10, perRow: 5 },
34 { name: "fruit", url: "images/object/fruit.png", subImgTotal: 15, perRow: 8 }
35 35 ]
36 , function()
37 {
38 game.images.frog_basic.addAnimationCycle("walk", [0,1,2,1], true);
39 game.images.tile_floor_explosion.addAnimationCycle("destroy", [0,1,2,3,4,5,6,7,8,9], false);
40 this.setupChaoAnimations(game.images.chao_default)
41 this.setupChaoAnimations(game.images.chao_blue)
42 this.setupChaoAnimations(game.images.chao_cyan)
43 this.setupChaoAnimations(game.images.chao_dark)
44 this.setupChaoAnimations(game.images.chao_darkgreen)
45 this.setupChaoAnimations(game.images.chao_green)
46 this.setupChaoAnimations(game.images.chao_lightgreen)
47 this.setupChaoAnimations(game.images.chao_hero)
48 this.setupChaoAnimations(game.images.chao_orange)
49 this.setupChaoAnimations(game.images.chao_pink)
50 this.setupChaoAnimations(game.images.chao_purple)
51 this.setupChaoAnimations(game.images.chao_red)
52 this.setupChaoAnimations(game.images.chao_white)
53 this.setupChaoAnimations(game.images.chao_yellow)
54
55 this.createMainScene(game);
56 });
57 }
36 , function ()
37 {
38 game.images.frog_basic.addAnimationCycle("walk", [0, 1, 2, 1], true);
39 game.images.tile_floor_explosion.addAnimationCycle("destroy", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], false);
40 this.setupChaoAnimations(game.images.chao_default);
41 this.setupChaoAnimations(game.images.chao_blue);
42 this.setupChaoAnimations(game.images.chao_cyan);
43 this.setupChaoAnimations(game.images.chao_dark);
44 this.setupChaoAnimations(game.images.chao_darkgreen);
45 this.setupChaoAnimations(game.images.chao_green);
46 this.setupChaoAnimations(game.images.chao_lightgreen);
47 this.setupChaoAnimations(game.images.chao_hero);
48 this.setupChaoAnimations(game.images.chao_orange);
49 this.setupChaoAnimations(game.images.chao_pink);
50 this.setupChaoAnimations(game.images.chao_purple);
51 this.setupChaoAnimations(game.images.chao_red);
52 this.setupChaoAnimations(game.images.chao_white);
53 this.setupChaoAnimations(game.images.chao_yellow);
58 54
59 function setupChaoAnimations(image)
55 this.createMainScene(game);
56 });
57 };
58
59 function setupChaoAnimations (image)
60 60 {
61 61 game.chaoImages.push(image);
62 image.addAnimationCycle("walkDown", [0, 1, 0, 2], true)
63 image.addAnimationCycle("walkLeft", [3, 4, 3, 5], true)
64 image.addAnimationCycle("walkUp", [6, 7, 6, 8], true)
65
66 image.addAnimationCycle("standDown", [0])
67 image.addAnimationCycle("standLeft", [3])
68 image.addAnimationCycle("standUp", [6])
69
70 image.addAnimationCycle("flyDown", [9, 10, 11, 10], true)
71 image.addAnimationCycle("flyLeft", [12, 13, 14, 13], true)
72 image.addAnimationCycle("flyUp", [15, 16, 17, 16], true)
73
74 image.addAnimationCycle("tripDown", [18, 19, 20])
75 image.addAnimationCycle("tripLeft", [21, 22, 23])
76 image.addAnimationCycle("tripUp", [24, 25, 26])
77
78 image.addAnimationCycle("sitDown", [27])
79 image.addAnimationCycle("sitLeft", [28])
80
81 image.addAnimationCycle("tantrum", [29, 30, 29, 31, 32, 33])
82
83 image.addAnimationCycle("swimStruggle", [34, 35], true)
84 image.addAnimationCycle("eatStart", [36, 37, 38], false, "eat")
85 image.addAnimationCycle("eat", [37, 38], true)
86
87 image.addAnimationCycle("cheer", [39, 40], true)
88 image.addAnimationCycle("wave", [41, 42])
89
90 image.addAnimationCycle("hungry", [43, 44], true)
91
92 image.addAnimationCycle("no", [45, 46, 45, 47], true)
93 image.addAnimationCycle("think", [48])
94 image.addAnimationCycle("happy", [49, 50, 49, 51], true)
95 image.addAnimationCycle("sad", [52])
96 image.addAnimationCycle("sleep", [53, 54], true)
97
98 image.addAnimationCycle("swim", [55, 56, 57], true)
99 image.addAnimationCycle("eatBig", [58, 59], true)
100 image.addAnimationCycle("sneeze", [60, 61, 62, 63], false, "standDown")
101 image.addAnimationCycle("cry", [64, 65], true)
102 image.addAnimationCycle("think2", [66])
62 image.addAnimationCycle("walkDown", [0, 1, 0, 2], true);
63 image.addAnimationCycle("walkLeft", [3, 4, 3, 5], true);
64 image.addAnimationCycle("walkUp", [6, 7, 6, 8], true);
65
66 image.addAnimationCycle("standDown", [0]);
67 image.addAnimationCycle("standLeft", [3]);
68 image.addAnimationCycle("standUp", [6]);
69
70 image.addAnimationCycle("flyDown", [9, 10, 11, 10], true);
71 image.addAnimationCycle("flyLeft", [12, 13, 14, 13], true);
72 image.addAnimationCycle("flyUp", [15, 16, 17, 16], true);
73
74 image.addAnimationCycle("tripDown", [18, 19, 20]);
75 image.addAnimationCycle("tripLeft", [21, 22, 23]);
76 image.addAnimationCycle("tripUp", [24, 25, 26]);
77
78 image.addAnimationCycle("sitDown", [27]);
79 image.addAnimationCycle("sitLeft", [28]);
80
81 image.addAnimationCycle("tantrum", [29, 30, 29, 31, 32, 33]);
82
83 image.addAnimationCycle("swimStruggle", [34, 35], true);
84 image.addAnimationCycle("eatStart", [36, 37, 38], false, "eat");
85 image.addAnimationCycle("eat", [37, 38], true);
86
87 image.addAnimationCycle("cheer", [39, 40], true);
88 image.addAnimationCycle("wave", [41, 42]);
89
90 image.addAnimationCycle("hungry", [43, 44], true);
91
92 image.addAnimationCycle("no", [45, 46, 45, 47], true);
93 image.addAnimationCycle("think", [48]);
94 image.addAnimationCycle("happy", [49, 50, 49, 51], true);
95 image.addAnimationCycle("sad", [52]);
96 image.addAnimationCycle("sleep", [53, 54], true);
97
98 image.addAnimationCycle("swim", [55, 56, 57], true);
99 image.addAnimationCycle("eatBig", [58, 59], true);
100 image.addAnimationCycle("sneeze", [60, 61, 62, 63], false, "standDown");
101 image.addAnimationCycle("cry", [64, 65], true);
102 image.addAnimationCycle("think2", [66]);
103 103 }
104 104
105 createMainScene = function(game)
105 createMainScene = function (game)
106 106 {
107 107 var scene = new Scene(0, 0, 1, 1, Scene.DisplayModes.relativeToParent);
108 108
109 109 game.loadScene(scene);
110 110
111 111 scene.addObject(new GrassTiler(50, 50, game.images.arrow, 0));
112 chao = new Chao(60,60, game.images.chao_default, 0);
113 caster = new Caster(200,200, game.images.arrow, 0);
112 chao = new Chao(60, 60, game.images.chao_default, 0);
114 113 scene.addObject(chao);
115 scene.addObject(caster);
116 114
117 115 createSubScene(scene);
118 }
116 };
119 117
120 createSubScene = function(scene)
118 createSubScene = function (scene)
121 119 {
122 var subScene = new FrogScene(200,200,500,600, Scene.DisplayModes.absolute);
120 var subScene = new FrogScene(200, 200, 500, 600, Scene.DisplayModes.absolute);
123 121
124 122 subScene.gameSpeed = 2;
125 123
126 124 scene.loadChildScene(subScene);
127 125
128 frog = new Frog(60,555, game.images.frog_basic, 0);
129 for(tx = 10; tx < subScene.real_size.x; tx += 15)
126 frog = new Frog(60, 555, game.images.frog_basic, 0);
127 for (tx = 10; tx < subScene.real_size.x; tx += 15)
130 128 {
131 129 subScene.addObject(new FloorTile(tx, 570, game.images.tile_floor_brown, 0));
132 130 }
133 131 subScene.addObject(frog);
134 }
132 };
@@ -2,133 +2,131 @@ console.log("Game started!");
2var game = new Game();
2var game = new Game();
3game.chaoImages = [];
3game.chaoImages = [];
4
4
5window.onload = function()
5window.onload = function ()
6{
6{
7
7
8 game.preloadImagesThenStart(
8 game.preloadImagesThenStart(
9 [
9 [
10 {name:"arrow", url:"images/arrow.png", subImgTotal: 4, perRow: 2},
10 { name: "arrow", url: "images/arrow.png", subImgTotal: 4, perRow: 2 },
11 {name:"gem", url:"images/gems.png", subImgTotal: 72, perRow: 6},
11 { name: "gem", url: "images/gems.png", subImgTotal: 72, perRow: 6 },
12 {name:"ball", url:"images/ball.png", subImgTotal: 4, perRow: 4},
12 { name: "ball", url: "images/ball.png", subImgTotal: 4, perRow: 4 },
13 {name:"grass_dark", url:"images/grass_dark.png"},
13 { name: "grass_dark", url: "images/grass_dark.png" },
14 {name:"grass_light", url:"images/grass_light.png"},
14 { name: "grass_light", url: "images/grass_light.png" },
15 {name:"frog_basic", url:"images/character/frog/frog_basic.png", subImgTotal: 4, perRow: 4},
15 { name: "frog_basic", url: "images/character/frog/frog_basic.png", subImgTotal: 4, perRow: 4 },
16 {name:"frog_tongue_base", url:"images/character/frog/frog_tongue_base.png"},
16 { name: "frog_tongue_base", url: "images/character/frog/frog_tongue_base.png" },
17 {name:"frog_tongue_tip", url:"images/character/frog/frog_tongue_tip.png"},
17 { name: "frog_tongue_tip", url: "images/character/frog/frog_tongue_tip.png" },
18 {name:"chao_default", url:"images/character/chao/default.png", subImgTotal: 67, perRow: 9},
18 { name: "chao_default", url: "images/character/chao/default.png", subImgTotal: 67, perRow: 9 },
19 {name:"chao_blue", url:"images/character/chao/blue.png", subImgTotal: 67, perRow: 9},
19 { name: "chao_blue", url: "images/character/chao/blue.png", subImgTotal: 67, perRow: 9 },
20 {name:"chao_cyan", url:"images/character/chao/cyan.png", subImgTotal: 67, perRow: 9},
20 { name: "chao_cyan", url: "images/character/chao/cyan.png", subImgTotal: 67, perRow: 9 },
21 {name:"chao_dark", url:"images/character/chao/dark.png", subImgTotal: 67, perRow: 9},
21 { name: "chao_dark", url: "images/character/chao/dark.png", subImgTotal: 67, perRow: 9 },
22 {name:"chao_darkgreen", url:"images/character/chao/darkgreen.png", subImgTotal: 67, perRow: 9},
22 { name: "chao_darkgreen", url: "images/character/chao/darkgreen.png", subImgTotal: 67, perRow: 9 },
23 {name:"chao_green", url:"images/character/chao/green.png", subImgTotal: 67, perRow: 9},
23 { name: "chao_green", url: "images/character/chao/green.png", subImgTotal: 67, perRow: 9 },
24 {name:"chao_lightgreen", url:"images/character/chao/lightgreen.png", subImgTotal: 67, perRow: 9},
24 { name: "chao_lightgreen", url: "images/character/chao/lightgreen.png", subImgTotal: 67, perRow: 9 },
25 {name:"chao_hero", url:"images/character/chao/hero.png", subImgTotal: 67, perRow: 9},
25 { name: "chao_hero", url: "images/character/chao/hero.png", subImgTotal: 67, perRow: 9 },
26 {name:"chao_orange", url:"images/character/chao/orange.png", subImgTotal: 67, perRow: 9},
26 { name: "chao_orange", url: "images/character/chao/orange.png", subImgTotal: 67, perRow: 9 },
27 {name:"chao_pink", url:"images/character/chao/pink.png", subImgTotal: 67, perRow: 9},
27 { name: "chao_pink", url: "images/character/chao/pink.png", subImgTotal: 67, perRow: 9 },
28 {name:"chao_purple", url:"images/character/chao/purple.png", subImgTotal: 67, perRow: 9},
28 { name: "chao_purple", url: "images/character/chao/purple.png", subImgTotal: 67, perRow: 9 },
29 {name:"chao_red", url:"images/character/chao/red.png", subImgTotal: 67, perRow: 9},
29 { name: "chao_red", url: "images/character/chao/red.png", subImgTotal: 67, perRow: 9 },
30 {name:"chao_white", url:"images/character/chao/white.png", subImgTotal: 67, perRow: 9},
30 { name: "chao_white", url: "images/character/chao/white.png", subImgTotal: 67, perRow: 9 },
31 {name:"chao_yellow", url:"images/character/chao/yellow.png", subImgTotal: 67, perRow: 9},
31 { name: "chao_yellow", url: "images/character/chao/yellow.png", subImgTotal: 67, perRow: 9 },
32 {name:"tile_floor_brown", url:"images/tile/tile_floor_brown.png"},
32 { name: "tile_floor_brown", url: "images/tile/tile_floor_brown.png" },
33 {name:"tile_floor_explosion", url:"images/tile/tile_floor_explosion_anim.png", subImgTotal:10, perRow:5},
33 { name: "tile_floor_explosion", url: "images/tile/tile_floor_explosion_anim.png", subImgTotal: 10, perRow: 5 },
34 {name:"fruit", url:"images/object/fruit.png", subImgTotal: 15, perRow: 8}
34 { name: "fruit", url: "images/object/fruit.png", subImgTotal: 15, perRow: 8 }
35 ]
35 ]
36 , function()
36 , function ()
37 {
37 {
38 game.images.frog_basic.addAnimationCycle("walk", [0,1,2,1], true);
38 game.images.frog_basic.addAnimationCycle("walk", [0, 1, 2, 1], true);
39 game.images.tile_floor_explosion.addAnimationCycle("destroy", [0,1,2,3,4,5,6,7,8,9], false);
39 game.images.tile_floor_explosion.addAnimationCycle("destroy", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], false);
40 this.setupChaoAnimations(game.images.chao_default)
40 this.setupChaoAnimations(game.images.chao_default);
41 this.setupChaoAnimations(game.images.chao_blue)
41 this.setupChaoAnimations(game.images.chao_blue);
42 this.setupChaoAnimations(game.images.chao_cyan)
42 this.setupChaoAnimations(game.images.chao_cyan);
43 this.setupChaoAnimations(game.images.chao_dark)
43 this.setupChaoAnimations(game.images.chao_dark);
44 this.setupChaoAnimations(game.images.chao_darkgreen)
44 this.setupChaoAnimations(game.images.chao_darkgreen);
45 this.setupChaoAnimations(game.images.chao_green)
45 this.setupChaoAnimations(game.images.chao_green);
46 this.setupChaoAnimations(game.images.chao_lightgreen)
46 this.setupChaoAnimations(game.images.chao_lightgreen);
47 this.setupChaoAnimations(game.images.chao_hero)
47 this.setupChaoAnimations(game.images.chao_hero);
48 this.setupChaoAnimations(game.images.chao_orange)
48 this.setupChaoAnimations(game.images.chao_orange);
49 this.setupChaoAnimations(game.images.chao_pink)
49 this.setupChaoAnimations(game.images.chao_pink);
50 this.setupChaoAnimations(game.images.chao_purple)
50 this.setupChaoAnimations(game.images.chao_purple);
51 this.setupChaoAnimations(game.images.chao_red)
51 this.setupChaoAnimations(game.images.chao_red);
52 this.setupChaoAnimations(game.images.chao_white)
52 this.setupChaoAnimations(game.images.chao_white);
53 this.setupChaoAnimations(game.images.chao_yellow)
53 this.setupChaoAnimations(game.images.chao_yellow);
54
55 this.createMainScene(game);
56 });
57}
58
54
59function setupChaoAnimations(image)
55 this.createMainScene(game);
56 });
57};
58
59function setupChaoAnimations (image)
60{
60{
61 game.chaoImages.push(image);
61 game.chaoImages.push(image);
62 image.addAnimationCycle("walkDown", [0, 1, 0, 2], true)
62 image.addAnimationCycle("walkDown", [0, 1, 0, 2], true);
63 image.addAnimationCycle("walkLeft", [3, 4, 3, 5], true)
63 image.addAnimationCycle("walkLeft", [3, 4, 3, 5], true);
64 image.addAnimationCycle("walkUp", [6, 7, 6, 8], true)
64 image.addAnimationCycle("walkUp", [6, 7, 6, 8], true);
65
65
66 image.addAnimationCycle("standDown", [0])
66 image.addAnimationCycle("standDown", [0]);
67 image.addAnimationCycle("standLeft", [3])
67 image.addAnimationCycle("standLeft", [3]);
68 image.addAnimationCycle("standUp", [6])
68 image.addAnimationCycle("standUp", [6]);
69
69
70 image.addAnimationCycle("flyDown", [9, 10, 11, 10], true)
70 image.addAnimationCycle("flyDown", [9, 10, 11, 10], true);
71 image.addAnimationCycle("flyLeft", [12, 13, 14, 13], true)
71 image.addAnimationCycle("flyLeft", [12, 13, 14, 13], true);
72 image.addAnimationCycle("flyUp", [15, 16, 17, 16], true)
72 image.addAnimationCycle("flyUp", [15, 16, 17, 16], true);
73
73
74 image.addAnimationCycle("tripDown", [18, 19, 20])
74 image.addAnimationCycle("tripDown", [18, 19, 20]);
75 image.addAnimationCycle("tripLeft", [21, 22, 23])
75 image.addAnimationCycle("tripLeft", [21, 22, 23]);
76 image.addAnimationCycle("tripUp", [24, 25, 26])
76 image.addAnimationCycle("tripUp", [24, 25, 26]);
77
77
78 image.addAnimationCycle("sitDown", [27])
78 image.addAnimationCycle("sitDown", [27]);
79 image.addAnimationCycle("sitLeft", [28])
79 image.addAnimationCycle("sitLeft", [28]);
80
80
81 image.addAnimationCycle("tantrum", [29, 30, 29, 31, 32, 33])
81 image.addAnimationCycle("tantrum", [29, 30, 29, 31, 32, 33]);
82
82
83 image.addAnimationCycle("swimStruggle", [34, 35], true)
83 image.addAnimationCycle("swimStruggle", [34, 35], true);
84 image.addAnimationCycle("eatStart", [36, 37, 38], false, "eat")
84 image.addAnimationCycle("eatStart", [36, 37, 38], false, "eat");
85 image.addAnimationCycle("eat", [37, 38], true)
85 image.addAnimationCycle("eat", [37, 38], true);
86
86
87 image.addAnimationCycle("cheer", [39, 40], true)
87 image.addAnimationCycle("cheer", [39, 40], true);
88 image.addAnimationCycle("wave", [41, 42])
88 image.addAnimationCycle("wave", [41, 42]);
89
89
90 image.addAnimationCycle("hungry", [43, 44], true)
90 image.addAnimationCycle("hungry", [43, 44], true);
91
91
92 image.addAnimationCycle("no", [45, 46, 45, 47], true)
92 image.addAnimationCycle("no", [45, 46, 45, 47], true);
93 image.addAnimationCycle("think", [48])
93 image.addAnimationCycle("think", [48]);
94 image.addAnimationCycle("happy", [49, 50, 49, 51], true)
94 image.addAnimationCycle("happy", [49, 50, 49, 51], true);
95 image.addAnimationCycle("sad", [52])
95 image.addAnimationCycle("sad", [52]);
96 image.addAnimationCycle("sleep", [53, 54], true)
96 image.addAnimationCycle("sleep", [53, 54], true);
97
97
98 image.addAnimationCycle("swim", [55, 56, 57], true)
98 image.addAnimationCycle("swim", [55, 56, 57], true);
99 image.addAnimationCycle("eatBig", [58, 59], true)
99 image.addAnimationCycle("eatBig", [58, 59], true);
100 image.addAnimationCycle("sneeze", [60, 61, 62, 63], false, "standDown")
100 image.addAnimationCycle("sneeze", [60, 61, 62, 63], false, "standDown");
101 image.addAnimationCycle("cry", [64, 65], true)
101 image.addAnimationCycle("cry", [64, 65], true);
102 image.addAnimationCycle("think2", [66])
102 image.addAnimationCycle("think2", [66]);
103}
103}
104
104
105createMainScene = function(game)
105createMainScene = function (game)
106{
106{
107 var scene = new Scene(0, 0, 1, 1, Scene.DisplayModes.relativeToParent);
107 var scene = new Scene(0, 0, 1, 1, Scene.DisplayModes.relativeToParent);
108
108
109 game.loadScene(scene);
109 game.loadScene(scene);
110
110
111 scene.addObject(new GrassTiler(50, 50, game.images.arrow, 0));
111 scene.addObject(new GrassTiler(50, 50, game.images.arrow, 0));
112 chao = new Chao(60,60, game.images.chao_default, 0);
112 chao = new Chao(60, 60, game.images.chao_default, 0);
113 caster = new Caster(200,200, game.images.arrow, 0);
114 scene.addObject(chao);
113 scene.addObject(chao);
115 scene.addObject(caster);
116
114
117 createSubScene(scene);
115 createSubScene(scene);
118}
116};
119
117
120createSubScene = function(scene)
118createSubScene = function (scene)
121{
119{
122 var subScene = new FrogScene(200,200,500,600, Scene.DisplayModes.absolute);
120 var subScene = new FrogScene(200, 200, 500, 600, Scene.DisplayModes.absolute);
123
121
124 subScene.gameSpeed = 2;
122 subScene.gameSpeed = 2;
125
123
126 scene.loadChildScene(subScene);
124 scene.loadChildScene(subScene);
127
125
128 frog = new Frog(60,555, game.images.frog_basic, 0);
126 frog = new Frog(60, 555, game.images.frog_basic, 0);
129 for(tx = 10; tx < subScene.real_size.x; tx += 15)
127 for (tx = 10; tx < subScene.real_size.x; tx += 15)
130 {
128 {
131 subScene.addObject(new FloorTile(tx, 570, game.images.tile_floor_brown, 0));
129 subScene.addObject(new FloorTile(tx, 570, game.images.tile_floor_brown, 0));
132 }
130 }
133 subScene.addObject(frog);
131 subScene.addObject(frog);
134}
132};