Created
May 5, 2012 15:34
-
-
Save anonymous/2603378 to your computer and use it in GitHub Desktop.
full PlayState.as code
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
package | |
{ | |
import org.flixel.*; | |
import org.flixel.plugin.photonstorm.FlxControl; | |
import org.flixel.plugin.photonstorm.FlxControlHandler; | |
public class PlayState extends FlxState | |
{ | |
private var level:FlxTileblock; | |
private var player:FlxSprite; | |
public function PlayState() | |
{ | |
super(); | |
} | |
override public function create():void{ | |
player = new FlxSprite(FlxG.width/2 - 5); | |
player.makeGraphic(10,12,0xffaa1111); | |
add(player); | |
level = new FlxTileblock(0, 208, 320, 32); | |
level.makeGraphic(320, 32, 0xff689c16); | |
add(level); | |
if (FlxG.getPlugin(FlxControl) == null) | |
{ | |
FlxG.addPlugin(new FlxControl); | |
} | |
FlxControl.create(player, FlxControlHandler.MOVEMENT_ACCELERATES, FlxControlHandler.STOPPING_DECELERATES, 1, true, false); | |
FlxControl.player1.setCursorControl(false, false, true, true); | |
FlxControl.player1.setJumpButton("SPACE", FlxControlHandler.KEYMODE_JUST_DOWN, 200,FlxObject.FLOOR, 250, 200); | |
FlxControl.player1.setMovementSpeed(400, 0, 100, 200, 400, 0); | |
FlxControl.player1.setGravity(0, 150); | |
} | |
override public function update():void{ | |
FlxG.collide(player, level); | |
super.update(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment