Permalink
Browse files

Committing code as version 0.4.0. Updated convergence to have control…

…ler logic outside the simulation logic
  • Loading branch information...
1 parent bc9de1f commit 76fb8701e59f704c7e305a3f2dcbc9a24c11141d @francoislaberge francoislaberge committed Jun 19, 2012
View
@@ -250,7 +250,7 @@ function I()
}
-bm={version:"0.3.0"};
+bm={version:"0.4.0"};
bm.MODE_GAMEPAD=0;
bm.MODE_KEYBOARD=1;
bm.MODE_NAVIGATION=2;
@@ -1,86 +1,58 @@
<!DOCTYPE html>
<html>
<head>
- <meta charset="UTF-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8" />
- <title>The Convergence Brass Monkey Mod - Brass Monkey</title>
-
- <script type="text/javascript" src="../../brassmonkey.js"></script>
-
- <link rel="stylesheet" type="text/css" href="styles/main.css"/>
-
-<script type="text/javascript">
-
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-9628132-5']);
- _gaq.push(['_trackPageview']);
-
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
-
-</script>
-</head>
-
+ <meta charset="UTF-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8" />
+ <title>The Convergence Brass Monkey Mod - Brass Monkey</title>
+
+ <link rel="stylesheet" type="text/css" href="styles/main.css"/>
+</head>
<body>
<!-- The canvas the project will render to. If you change its ID, don't forget to change the
ID the runtime looks for in the jQuery ready event (above). -->
<div id="ContentWrapper">
- <canvas id="c2canvas" width="960" height="640" oncontextmenu="return false;" onselectstart="return false;" >
- <div class="wrapper">
- <div class="error-message">
- <div class="error-message-wrapper">
- <div class="left">
- <img src="http://prod.playbrassmonkey.com/images/warningWhite.png">
- </div>
- <div class="right">
- <p>Your browser does not appear to support HTML5. Try upgrading your browser to the latest version.</p>
+ <canvas id="c2canvas" width="960" height="640" oncontextmenu="return false;" onselectstart="return false;" >
+ <div class="wrapper">
+ <div class="error-message">
+ <div class="error-message-wrapper">
+ <div class="left">
+ <img src="http://prod.playbrassmonkey.com/images/warningWhite.png">
+ </div>
+ <div class="right">
+ <p>Your browser does not appear to support HTML5. Try upgrading your browser to the latest version.</p>
+ </div>
</div>
</div>
+ <div class="content">
+ <h1 class="what-is-a-browser"><a href="http://www.whatbrowser.org" target="_top">What is a browser?</a></h1>
+ <div class="browsers">
+ <h2>Upgrade to the latest version of your favorite browser.</h2>
+ <p><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx" target="_top">Microsoft Internet Explorer</a></p>
+ <p><a href="http://www.mozilla.com/firefox/" target="_top">Mozilla Firefox</a></p>
+ <p><a href="http://www.google.com/chrome/" target="_top">Google Chrome</a></p>
+ <p><a href="http://www.apple.com/safari/download/" target="_top">Apple Safari</a></p>
+ <p><a href="http://www.google.com/chromeframe" target="_top">Google Chrome Frame for Internet Explorer</a></p>
+ </div>
+ </div>
</div>
- <div class="content">
-
-
- <h1 class="what-is-a-browser"><a href="http://www.whatbrowser.org" target="_top">What is a browser?</a></h1>
-
- <div class="browsers">
- <h2>Upgrade to the latest version of your favorite browser.</h2>
- <p><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx" target="_top">Microsoft Internet Explorer</a></p>
- <p><a href="http://www.mozilla.com/firefox/" target="_top">Mozilla Firefox</a></p>
- <p><a href="http://www.google.com/chrome/" target="_top">Google Chrome</a></p>
- <p><a href="http://www.apple.com/safari/download/" target="_top">Apple Safari</a></p>
- <p><a href="http://www.google.com/chromeframe" target="_top">Google Chrome Frame for Internet Explorer</a></p>
- </div>
-
- </div>
- </div>
- </canvas>
-
-
- </div>
-
-
+ </canvas>
+ </div>
+
<!-- Pages load faster with scripts at the bottom -->
-
+ <script type="text/javascript" src="../../brassmonkey.js"></script>
<script src="scripts/jquery-1.6.3.min.js"></script>
+ <script src="scripts/controls.js"></script>
-
-
- <!-- The runtime script. You can rename it, but don't forget to rename the reference here as well.
- This file will have been minified and obfuscated if you enabled "Minify script" during export. -->
+ <!-- The runtime script. You can rename it, but don't forget to rename the reference here as well. -->
+ <!-- This file will have been minified and obfuscated if you enabled "Minify script" during export. -->
<script src="scripts/the-convergence.js"></script>
-
-
- <script>
- // Start the Construct 2 project running on window load.
- jQuery(document).ready(function ()
- {
- // Create new runtime using the c2canvas
- cr.createRuntime("c2canvas");
- });
- </script>
+ <script>
+ // Start the Construct 2 project running on window load.
+ $(document).ready(function(){
+ // Create new runtime using the c2canvas
+ cr.createRuntime("c2canvas");
+ });
+ </script>
</body>
</html>
<!-- Localized -->
@@ -0,0 +1,127 @@
+
+// Initialize Brass Monkey
+bm.init({
+ // The Name that will be displayed on phone when
+ // trying to connect to the game to control it.
+ name: "The Convergence",
+
+ // This game is single player, set it's max players accordingly
+ bmMaxPlayers:1,
+
+ // Use this appID for now. We are building our developer portal
+ // back end as we speak.
+ bmAppId:"dfbc9769ef641e415aac8ee86224c9fa",
+
+ // Location of the brassmonkey.swf the SDK depends on.
+ // Coming soon this dependency will be removed for platforms
+ // like Mobile Safari that don't support flash.
+ swfURL:"../../swf/bin/brassmonkey.swf",
+
+ // Describe the controller's design/layout
+ design: {
+ // Which orientation is your controller designed for
+ orientation: "landscape",
+
+ // Disable touch/accelerometer if you aren't using it
+ // to improve network performance.
+ touchEnabled: false,
+ accelerometerEnabled: false,
+
+ // List of images used for this controller
+ images:[
+ 'images/background.png',
+ 'images/left.png',
+ 'images/left-down.png',
+ 'images/right.png',
+ 'images/right-down.png',
+ 'images/flip.png',
+ 'images/flip-down.png'
+ ],
+
+ // List of all the images/buttons in the controller layout
+ // Attributes
+ // Images and Buttons
+ // type | 'image' or 'button'
+ // x,y,width, and height | Position of elements (in pixels)
+ // Images only
+ // image | zero based index of the image to display
+ // | from the 'images' list
+ // Buttons only
+
+
+
+ layout:[{
+ type: "image",
+ image: 0,
+ x: 0,
+ y: 0,
+ width: 480,
+ height: 320
+ }, {
+ type: "button",
+ handler: "left",
+ imageUp: 1,
+ imageDown: 2,
+ x: 0,
+ y: 113,
+ width: 103,
+ height: 103
+ }, {
+ type: "button",
+ handler: "right",
+ imageUp: 3,
+ imageDown: 4,
+ x: 167,
+ y: 113,
+ width: 103,
+ height: 103
+ }, {
+ type: "button",
+ handler: "flip",
+ imageUp: 5,
+ imageDown: 6,
+ x: 280,
+ y: 92,
+ width: 192,
+ height: 146
+ }]
+ }
+});
+
+// Once the device becomes available set it GamePad Mode to
+// show us our custom game controller
+bm.onDeviceAvailable(function(device){
+ device.controlMode=bm.MODE_GAMEPAD;
+ return device;
+});
+
+// Listen for button events
+bm.onInvocation(function(invoke, deviceId){
+ // Is the button up or down now
+ var isDown = invoke.parameters[0].Value=="down";
+
+ // Which button was it? ('left', 'right', or 'flip')
+ var button = invoke.methodName;
+
+ // Special logic for starting the game if we're
+ // on the home screen and the user presses the 'flip' button
+ if(button=="flip"&&isDown&&startGame()){
+ return;
+ }
+
+ // Button Down
+ if(isDown){
+ emulatedKeyDown(button);
+ } else {
+ // Button Up
+ emulatedKeyUp(button);
+ }
+});
+
+
+bm.onShowSlot(function(color){
+ // Todo: Display the slot color somewhere on the game's screen.
+ // This is the color that shows up in the device list on the controller for
+ // selecting what game/pc to connect to in order to control it.
+ // It's a CSS hex style color (ie. #ff0000)
+});
Oops, something went wrong.

0 comments on commit 76fb870

Please sign in to comment.