Created
March 4, 2019 16:13
-
-
Save 01010111/b600cd7825b62bbcecdc204f65d8545e to your computer and use it in GitHub Desktop.
Very simple heaps example
This file contains hidden or 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
| import h2d.Scene; | |
| import h2d.Graphics; | |
| import hxd.App; | |
| import hxd.Key; | |
| class Game extends App | |
| { | |
| static function main() new Game(); | |
| var player:Player; | |
| override function init() | |
| { | |
| player = new Player(this.s2d); | |
| } | |
| override function update(dt) | |
| { | |
| player.player_move(10); | |
| } | |
| } | |
| class Player extends Graphics | |
| { | |
| public function new(scene:Scene) | |
| { | |
| super(scene); | |
| beginFill(0xffffff); | |
| drawRect(0, 0, 30, 30); | |
| endFill(); | |
| } | |
| public function player_move(speed:Float) | |
| { | |
| if (Key.isDown(Key.A)) x -= speed; | |
| if (Key.isDown(Key.D)) x += speed; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment