Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sprite scale. Set initial action to be the first one. Sprite test to …
…show it works.
- Loading branch information
Showing
8 changed files
with
138 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<!-- ***** Load flashcanvas for Internet Explorer compatibility ***** --> | ||
|
||
<!--[if lt IE 9]> | ||
<script type="text/javascript" src="flashcanvas/bin/flashcanvas.js"></script> | ||
<![endif]--> | ||
|
||
<!-- ***** load the jsGameSoup library and define our game objects and launch function ***** --> | ||
|
||
<script src="../js/jsgamesoup.js"></script> | ||
<script src="../js/sprite.js"></script> | ||
<script> | ||
function WobblePlane(gs) { | ||
var s = new Sprite(["center", "center"], {"default": [["plane-1.png", 3], ["plane-2.png", 3], ["plane-3.png", 3]]}); | ||
|
||
this.update = function() { | ||
s.update(); | ||
} | ||
|
||
this.draw = function(c) { | ||
s.draw(c, [gs.width / 2.0 + 100 * Math.sin(gs.frameCount * 0.05), gs.height / 2.0]); | ||
} | ||
} | ||
|
||
function SmallPlane(gs) { | ||
var x = 0.5; | ||
var y = 0.5; | ||
var s = new Sprite(["center", "center"], {"default": [["planeb-1.png", 3], ["planeb-2.png", 3]]}, false, 0.5); | ||
|
||
this.update = function() { | ||
s.update(); | ||
} | ||
|
||
this.draw = function(c) { | ||
s.draw(c, [gs.width / 2.0, gs.height / 3.0]); | ||
} | ||
} | ||
|
||
JSGameSoup.ready(function() { | ||
// use the DIV tag with Id of 'surface' as our game surface | ||
var gs = new JSGameSoup("surface", 30); | ||
var images = ["plane-1.png", "plane-2.png", "plane-3.png"]; | ||
Sprite.preload(images, function() { | ||
// add an instance of the TestSprite class | ||
gs.addEntity(new WobblePlane(gs)); | ||
gs.addEntity(new SmallPlane(gs)); | ||
}); | ||
// launch the game | ||
gs.launch(); | ||
}); | ||
</script> | ||
|
||
<!-- ***** basic style for our demo page to fill the screen ***** --> | ||
<style> | ||
html, body { | ||
margin: 0px; | ||
padding: 0px; | ||
overflow: hidden; | ||
} | ||
div { | ||
width: 100%; | ||
height: 100%; | ||
position: absolute; | ||
top: -1px; | ||
left: -1px; | ||
} | ||
</style> | ||
|
||
<!-- ***** iPod/iPad and Android compatibility ***** --> | ||
|
||
<!-- icon for the ipod --> | ||
<link rel="apple-touch-icon" href="ipod-icon.png"> | ||
<!-- this is a web app --> | ||
<meta name="apple-mobile-web-app-capable" content="yes"> | ||
<!-- default size apple viewport --> | ||
<meta name="viewport" content="width=850"> | ||
<!-- app style status bar --> | ||
<meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
<style type="text/css"> | ||
<!-- | ||
* { | ||
/* disable callout sheet */ | ||
-webkit-touch-callout: none; | ||
/* disable highlighting links when tapped */ | ||
-webkit-tap-highlight-color: rgba(0,0,0,0); | ||
/* prevent automatic resizing of text */ | ||
-webkit-text-size-adjust: none; | ||
/* disable copy paste */ | ||
-webkit-user-select: none; | ||
} | ||
|
||
/* allow copy paste for some elements */ | ||
.copypaste { | ||
-webkit-user-select: text; | ||
} | ||
--> | ||
</style> | ||
</head> | ||
<body> | ||
<div id='surface'></div> | ||
</body> | ||
</html> |