Skip to content
This repository
Browse code

Merge pull request #1 from moigagoo/master

[~] Naming improvements.
  • Loading branch information...
commit b95a227be171364d088cbc692a2e9415127e1099 2 parents 42b93b0 + 2bea1ce
Andrew Kulakov authored
4 index.html
@@ -11,8 +11,8 @@
11 11 <script src="./js/init.js"></script>
12 12 <script src="./js/collection.js"></script>
13 13 <script src="./js/controller.js"></script>
14   - <script src="./js/bullit.js"></script>
15   - <script src="./js/bullits.js"></script>
  14 + <script src="./js/bullet.js"></script>
  15 + <script src="./js/bullets.js"></script>
16 16 <script src="./js/player.js"></script>
17 17 <script src="./js/enemy.js"></script>
18 18 <script src="./js/enemies.js"></script>
16 js/bullit.js → js/bullet.js
... ... @@ -1,4 +1,4 @@
1   -TextGalactic.BullitTypes = {
  1 +TextGalactic.BulletTypes = {
2 2 simple: {
3 3 text: ".",
4 4 rate: 10,
@@ -25,9 +25,9 @@ TextGalactic.BullitTypes = {
25 25 }
26 26 };
27 27
28   -TextGalactic.Bullit = atom.Class(
  28 +TextGalactic.Bullet = atom.Class(
29 29 /**
30   - * @lends TextGalactic.Bullit#
  30 + * @lends TextGalactic.Bullet#
31 31 * @augments LibCanvas.Scene.Element#
32 32 */
33 33 {
@@ -35,7 +35,7 @@ TextGalactic.Bullit = atom.Class(
35 35
36 36 direction: 'up',
37 37
38   - type: TextGalactic.BullitTypes['simple'],
  38 + type: TextGalactic.BulletTypes['simple'],
39 39
40 40 /** @constructs */
41 41 initialize: function (scene, options) {
@@ -54,12 +54,12 @@ TextGalactic.Bullit = atom.Class(
54 54
55 55 if (this.direction == 'up') {
56 56 move(this, 0, -moveSpeed);
57   - this.options.bullits.checkEnemyCollision(this);
  57 + this.options.bullets.checkEnemyCollision(this);
58 58 } else {
59 59 move(this, 0, moveSpeed);
60   - this.options.bullits.checkPlayerCollision(this);
  60 + this.options.bullets.checkPlayerCollision(this);
61 61 }
62   - // Deestroy bullit if it's the canvas
  62 + // Deestroy bullet if it's the canvas
63 63 if (
64 64 this.shape._center.y > this.scene.resources.rectangle.to.y
65 65 || this.shape._center.y < this.scene.resources.rectangle.from.y
@@ -70,7 +70,7 @@ TextGalactic.Bullit = atom.Class(
70 70
71 71 explode: function (){
72 72 this.destroy;
73   - this.options.bullits._destroy(this);
  73 + this.options.bullets._destroy(this);
74 74 },
75 75
76 76 renderTo: function (ctx) {
4 js/bullits.js → js/bullets.js
... ... @@ -1,4 +1,4 @@
1   -TextGalactic.Bullits = atom.Class({
  1 +TextGalactic.Bullets = atom.Class({
2 2
3 3 Extends: TextGalactic.Collection,
4 4
@@ -16,7 +16,7 @@ TextGalactic.Bullits = atom.Class({
16 16 },
17 17
18 18 create: function (fromPoint, bullitType, direction) {
19   - var bullit = this.storage.push(new TextGalactic.Bullit(this.scene, {
  19 + var bullit = this.storage.push(new TextGalactic.Bullet(this.scene, {
20 20 shape: new Circle(fromPoint, TextGalactic.Settings.font_size),
21 21 type: bullitType,
22 22 direction: direction,
6 js/controller.js
@@ -19,13 +19,13 @@ TextGalactic.Controller = atom.Class(
19 19
20 20 this.enemies = new TextGalactic.Enemies(this.activeScene, this);
21 21
22   - this.bullits = new TextGalactic.Bullits(this.activeScene, this);
  22 + this.bullets = new TextGalactic.Bullets(this.activeScene, this);
23 23
24 24 this.createEnemies()
25 25 },
26 26
27   - getBullits: function() {
28   - return this.bullits;
  27 + getBullets: function() {
  28 + return this.bullets;
29 29 },
30 30
31 31 getPlayer: function() {
50 js/enemy.js
... ... @@ -1,52 +1,52 @@
1   -TextGalactic.Enemis = {
  1 +TextGalactic.Enemies = {
2 2 0: {
3 3 text: "W",
4   - healf: 100,
  4 + health: 100,
5 5 speed: 150,
6 6 },
7 7 1: {
8 8 text: "T",
9   - healf: 150,
  9 + health: 150,
10 10 speed: 140,
11 11 },
12 12 2: {
13 13 text: "Y",
14   - healf: 200,
  14 + health: 200,
15 15 speed: 130,
16   - bullitType: TextGalactic.BullitTypes['big'],
  16 + bulletType: TextGalactic.BulletTypes['big'],
17 17 },
18 18 3: {
19 19 text: "U",
20   - healf: 250,
  20 + health: 250,
21 21 speed: 120,
22 22 },
23 23 4: {
24 24 text: "I",
25   - healf: 300,
  25 + health: 300,
26 26 speed: 110,
27   - bullitType: TextGalactic.BullitTypes['lazer'],
  27 + bulletType: TextGalactic.BulletTypes['lazer'],
28 28 },
29 29 5: {
30 30 text: "H",
31   - healf: 350,
  31 + health: 350,
32 32 speed: 100,
33 33 },
34 34 6: {
35 35 text: "X",
36   - healf: 360,
  36 + health: 360,
37 37 speed: 90,
38   - bullitType: TextGalactic.BullitTypes['simple'],
  38 + bulletType: TextGalactic.BulletTypes['simple'],
39 39 },
40 40 7: {
41 41 text: "V",
42   - healf: 370,
  42 + health: 370,
43 43 speed: 70,
44 44 },
45 45 8: {
46 46 text: "M",
47   - healf: 380,
  47 + health: 380,
48 48 speed: 50,
49   - bullitType: TextGalactic.BullitTypes['simple'],
  49 + bulletType: TextGalactic.BulletTypes['simple'],
50 50 }
51 51 }
52 52
@@ -77,9 +77,9 @@ TextGalactic.Enemy = atom.Class(
77 77 initialize: function (scene, options) {
78 78 this.parent( scene, options );
79 79 this.addEvent( 'moveDrag', this.redraw );
80   - this.enemy = TextGalactic.Enemis[options.enemyType];
  80 + this.enemy = TextGalactic.Enemies[options.enemyType];
81 81 this.speed = this.enemy.speed;
82   - this.healf = this.enemy.healf;
  82 + this.health = this.enemy.health;
83 83 this.dx = (getRandomInt(0, 1) == 0) ? 1: -1;
84 84 this.dy = getRandomArbitary(0.8, 1.2);
85 85 },
@@ -89,7 +89,7 @@ TextGalactic.Enemy = atom.Class(
89 89 },
90 90
91 91 rate: 0,
92   - healf: 0,
  92 + health: 0,
93 93
94 94 dx: 1,
95 95 dy: -1,
@@ -99,10 +99,10 @@ TextGalactic.Enemy = atom.Class(
99 99 speed: TextGalactic.Settings.speed - 50 ,
100 100
101 101 hit: function() {
102   - this.healf = this.healf - 100;
  102 + this.health = this.health - 100;
103 103 this.redraw();
104 104
105   - if (this.healf < 0) {
  105 + if (this.health < 0) {
106 106 return null;
107 107 }
108 108
@@ -131,11 +131,11 @@ TextGalactic.Enemy = atom.Class(
131 131 this.normalize_d();
132 132
133 133 // make shoot
134   - if (this.enemy.bullitType !== undefined) {
135   - if (this.rate > this.enemy.bullitType.rate * 4) {
136   - this.options.controller.getBullits().create(
  134 + if (this.enemy.bulletType !== undefined) {
  135 + if (this.rate > this.enemy.bulletType.rate * 4) {
  136 + this.options.controller.getBullets().create(
137 137 new Point(this.shape.from.x, this.shape.to.y),
138   - this.enemy.bullitType,
  138 + this.enemy.bulletType,
139 139 'down'
140 140 );
141 141
@@ -148,8 +148,8 @@ TextGalactic.Enemy = atom.Class(
148 148
149 149 renderTo: function (ctx) {
150 150 //ctx.fill( this.shape, ctx.createRectangleGradient( this.shape, this.colors[this.lives] ));
151   - var healfq = Math.round(this.healf/this.enemy.healf * 255);
152   - ctx.fillStyle = "rgb(" + (healfq) + ", " + (healfq) + "," + (healfq) + ")";
  151 + var healthq = Math.round(this.health/this.enemy.health * 255);
  152 + ctx.fillStyle = "rgb(" + (healthq) + ", " + (healthq) + "," + (healthq) + ")";
153 153
154 154 ctx.font = "normal normal " + TextGalactic.Settings.font_size + "px courier";
155 155 ctx.fillText(this.enemy.text, this.shape.from.x, this.shape.to.y);
16 js/player.js
@@ -28,19 +28,19 @@ TextGalactic.Player = atom.Class(
28 28 return this.collisionRectangle;
29 29 },
30 30
31   - healf: 300,
  31 + health: 300,
32 32
33 33 rate: 0,
34 34
35 35 speed: TextGalactic.Settings.speed - 50 ,
36 36
37   - bullitType: TextGalactic.BullitTypes['simple'],
  37 + bulletType: TextGalactic.BullitTypes['simple'],
38 38
39 39 hit: function () {
40   - this.healf = this.healf - 25;
  40 + this.health = this.health - 25;
41 41 this.redraw();
42 42
43   - if (this.healf < 0) {
  43 + if (this.health < 0) {
44 44 this.destroy();
45 45 }
46 46
@@ -92,10 +92,10 @@ TextGalactic.Player = atom.Class(
92 92
93 93 move(this, dx, dy);
94 94
95   - if (this.rate > this.bullitType.rate) {
  95 + if (this.rate > this.bulletType.rate) {
96 96 this.options.controller.getBullits().create(
97 97 new Point(this.shape.from.x, this.shape.from.y),
98   - this.bullitType,
  98 + this.bulletType,
99 99 'up'
100 100 );
101 101
@@ -106,8 +106,8 @@ TextGalactic.Player = atom.Class(
106 106 },
107 107
108 108 renderTo: function (ctx) {
109   - var healfq = Math.round(this.healf/300 * 255);
110   - ctx.fillStyle = "rgb(255, " + (healfq) + "," + (healfq) + ")";
  109 + var healthq = Math.round(this.health/300 * 255);
  110 + ctx.fillStyle = "rgb(255, " + (healthq) + "," + (healthq) + ")";
111 111 ctx.font = "normal normal " + TextGalactic.Settings.font_size + "px courier";
112 112 ctx.fillText("A", this.shape.from.x, this.shape.to.y);
113 113

0 comments on commit b95a227

Please sign in to comment.
Something went wrong with that request. Please try again.