forked from Humoralpathologie/S2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
131 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
This code is © 2012 by Roger Braun and Jiayi Zheng. | ||
All art assets are © 2012 by Henrik Haberman and Tim Schierbaum. | ||
|
||
GTween (http://gskinner.com/libraries/gtween/) is licensed under a MIT License. | ||
|
||
The code and art assets are not free to use. You can read, modify and compile them for your personal or educational use, but you can't redistribute any modified code, assets or resulting binaries. | ||
|
||
We want other people to be able to learn from this code and see how we did it. Have fun! |
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
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,3 @@ | ||
To compile: | ||
|
||
mxmcl -library-path+=lib Main.as |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package { | ||
import org.axgl.*; | ||
import org.axgl.text.*; | ||
import org.axgl.input.*; | ||
import org.humoralpathologie.axgleffects.*; | ||
public class SnakeDeath extends AxState { | ||
// TODO: Use better image | ||
[Embed(source='assets/images/introsnake.png')] protected var sadSnake:Class; | ||
private var _timer:Number = 0; | ||
private var _addedText:Boolean = false; | ||
|
||
override public function create():void { | ||
var fsprite:FloodFilledSprite = new FloodFilledSprite(0,0,sadSnake,8); | ||
fsprite.x = (640 - fsprite.width) / 2; | ||
|
||
add(fsprite); | ||
} | ||
|
||
override public function update():void { | ||
super.update(); | ||
_timer += Ax.dt; | ||
if(_addedText) { | ||
if(Ax.keys.pressed(AxKey.SPACE)) { | ||
Ax.popState(); | ||
} | ||
} else if(_timer >= 2) { | ||
var text:AxText = new AxText(0,350,null, "PRESS SPACE", 640 / 4, 'center'); | ||
text.scale.x = 4; | ||
text.scale.y = 4; | ||
add(text); | ||
_addedText = true; | ||
} | ||
} | ||
} | ||
} |
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,16 @@ | ||
package { | ||
import org.axgl.*; | ||
import com.gskinner.motion.*; | ||
import com.gskinner.motion.easing.*; | ||
|
||
public class TweenTestState extends AxState { | ||
override public function create():void { | ||
var testsprite:AxSprite = new AxSprite(20,20); | ||
testsprite.create(20,20,0xff00ff00); | ||
add(testsprite); | ||
GTweener.to(testsprite,2,{x: 500, y:400},{ease:Exponential.easeInOut}); | ||
GTweener.to(testsprite.scale,2,{x: 4, y:3},{ease:Sine.easeInOut}); | ||
GTweener.to(testsprite,1,{alpha: 0.5}); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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,51 @@ | ||
package org.humoralpathologie.axgleffects { | ||
import org.axgl.*; | ||
import flash.display.BitmapData; | ||
import flash.display.Bitmap; | ||
import flash.geom.Point; | ||
import flash.geom.Rectangle; | ||
|
||
public class FloodFilledSprite extends AxSprite { | ||
|
||
private var _canvas:BitmapData; | ||
private var _fullImage:BitmapData; | ||
private var _currY:int; | ||
private var _step:int = 1; | ||
|
||
public function FloodFilledSprite(x:Number, y:Number, resource:*, step:int = 1) { | ||
super(x,y); | ||
_step = step; | ||
|
||
if (resource is Class) { | ||
_fullImage = (new resource() as Bitmap).bitmapData; | ||
} else if (resource is BitmapData) { | ||
_fullImage = resource; | ||
} else { | ||
throw new Error("Invalid resource:", resource); | ||
} | ||
|
||
_canvas = new BitmapData(_fullImage.width, _fullImage.height, true, 0x00000000); | ||
_currY = 0; | ||
load(_canvas); | ||
} | ||
|
||
override public function update():void { | ||
|
||
for(var j:int = 0; j < _step; j++){ | ||
if(_currY + 1 < height) { | ||
var r:Rectangle; | ||
var p:Point = new Point(0,0); | ||
r = new Rectangle(0,height - (_currY + 1),width,1); | ||
for(var i:int = 0; i <= height - _currY; i++) { | ||
p.y = i; | ||
_canvas.copyPixels(_fullImage,r,p); | ||
} | ||
_currY++; | ||
load(_canvas); | ||
} | ||
} | ||
|
||
super.update(); | ||
} | ||
} | ||
} |