Permalink
Browse files

Various gameplay & UI tweaks

  • Loading branch information...
1 parent 513fe18 commit 49d696dd1f394222ee042b063b079979615fe2d2 @austinhallock austinhallock committed Jun 9, 2012
View
@@ -3,12 +3,12 @@ require 'rubygems'
require 'uglifier'
require 'fssm'
-CLI_SRC_PATH = './src/client'
-SVR_SRC_PATH = './src/server'
-SHARED_SRC_PATH = './src/shared'
-CLI_BUILD_PATH = './build/client'
-SVR_BUILD_PATH = './build/server'
-CLI_OUT_PATH = './build/client/game'
+CLI_SRC_PATH = './src/client' # path to source code for client side
+SVR_SRC_PATH = './src/server' # path to source code for server side
+SHARED_SRC_PATH = './src/shared' # path to source code that is shared between client & server
+CLI_BUILD_PATH = './build/client' # all individual coffeescript files are compiled to indiv. js files in this path
+SVR_BUILD_PATH = './build/server' # all individual coffeescript files are compiled to indiv. js files in this path
+CLI_OUT_PATH = './build/client/game' # produces game.js and game.min.js in that build/client
# read_manifest: accepts a directory containing a manifest.js
# file, and returns an array of the files required in the manifest
View
@@ -1,14 +1,16 @@
-var Ball, Constants, Sprite;
-var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
+var Ball, Constants, Helpers, Sprite,
+ __hasProp = Object.prototype.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
if (module) {
Sprite = require('./sprite');
Constants = require('./constants');
+ Helpers = require('./helpers');
}
-Ball = (function() {
+Ball = (function(_super) {
- __extends(Ball, Sprite);
+ __extends(Ball, _super);
function Ball(x, y) {
this.x = x;
@@ -20,8 +22,19 @@ Ball = (function() {
Ball.__super__.constructor.call(this, this.x, this.y, this.radius * 2, this.radius * 2, this.bg);
}
+ Ball.prototype.collidesWith = function(obj) {
+ return this.y + this.height < obj.y + obj.height && Math.sqrt(Math.pow((this.x + this.radius) - (obj.x + obj.radius), 2) + Math.pow((this.y + this.radius) - (obj.y + obj.radius), 2)) < this.radius + obj.radius;
+ };
+
+ Ball.prototype.resolveCollision = function(obj) {
+ var a;
+ a = Helpers.rad2Deg(Math.atan(-((this.x + this.radius) - (obj.x + obj.radius)) / ((this.y + this.radius) - (obj.y + obj.radius))));
+ this.velocity.x = Helpers.xFromAngle(a) * (6.5 + 2 * Constants.AI_DIFFICULTY) + 0.05 * obj.velocity.x;
+ return this.velocity.y = Helpers.yFromAngle(a) * (6.5 + 2 * Constants.AI_DIFFICULTY) + 0.05 * obj.velocity.y;
+ };
+
return Ball;
-})();
+})(Sprite);
if (module) module.exports = Ball;
View
@@ -1,9 +1,10 @@
-var Button;
-var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
+var Button,
+ __hasProp = Object.prototype.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
-Button = (function() {
+Button = (function(_super) {
- __extends(Button, Sprite);
+ __extends(Button, _super);
function Button(x, y, width, height, img, downImg, scene) {
this.x = x;
@@ -45,4 +46,4 @@ Button = (function() {
return Button;
-})();
+})(Sprite);
@@ -24,10 +24,11 @@ Constants = {
SLIME_JUMP: 10,
BALL_RADIUS: 10,
BALL_MASS: 1.4,
- MOVEMENT_SPEED: 4,
+ HELPER_SIZE: 10,
+ MOVEMENT_SPEED: 5,
JUMP_SPEED: 12,
SLIME_START_HEIGHT: 91,
- AI_DIFFICULTY: 0.25,
+ AI_DIFFICULTY: 0.45,
MSG_FONT: 'Courier, monospace, sans-serif',
FPS_RATIO: 24 / 16,
TICK_DURATION: 24,
Oops, something went wrong.

0 comments on commit 49d696d

Please sign in to comment.