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
| static public function tiled_tile_has_property( _tilemap:TiledMap, _layer:String, _position_x:Float, _position_y:Float, _property:String ) : Bool { | |
| var tile_coordinates = _tilemap.tile_coord(_position_x, _position_y); | |
| if(_tilemap.inside(Std.int(tile_coordinates.x), Std.int(tile_coordinates.y))) { | |
| var current_tile_id : Int = _tilemap.tile_at_pos(_layer, _position_x, _position_y).id - 1; | |
| for(tiled_tileset in _tilemap.tiledmap_data.tilesets) { | |
| for(tiled_tile in tiled_tileset.property_tiles) { | |
| if(current_tile_id == tiled_tile.id) { | |
| return tiled_tile.properties.exists(_property); | |
| } |
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
| override function ready() { | |
| Luxe.renderer.clear_color = new Color().rgb(0x57a4f3); | |
| } //ready |
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
| Process: adrifter [32903] | |
| Path: /Users/USER/*/adrifter.app/Contents/MacOS/adrifter | |
| Identifier: com.jonathanhirz.adrifter | |
| Version: 0.0.1 (1) | |
| Code Type: X86-64 (Native) | |
| Parent Process: node-mac [32205] | |
| Responsible: Terminal [340] | |
| User ID: 501 | |
| Date/Time: 2015-12-15 17:28:33.031 -0800 |
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
| override function update(dt:Float) { | |
| velocity.x += acceleration.x * dt; | |
| monster.pos.x += velocity.x * dt; | |
| velocity.y += acceleration.y * dt; | |
| monster.pos.y += velocity.y * dt; | |
| if(Luxe.input.inputdown('right')) { | |
| acceleration.x = move_speed; | |
| } |
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
| override function update(dt:Float) { | |
| if(Luxe.time - count_time > 0.5) { | |
| count_time = Luxe.time; | |
| fps_text.text = 'FPS: ' + Std.int(1.0 / Luxe.dt); | |
| } | |
| } //update |
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 luxe.options.GeometryOptions; | |
| import luxe.Vector; | |
| import phoenix.Batcher; | |
| import phoenix.geometry.Geometry; | |
| import phoenix.geometry.Vertex; | |
| class TriangleGeometry extends Geometry { | |
| public function new(?options: TriangleOptions) { |
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
| override function onenter<T>( _value:T ) { | |
| earth = new Sprite({ | |
| texture : earth_texture, | |
| pos : new Vector(Luxe.screen.w/2, Luxe.screen.h), | |
| }); | |
| transformGesture = new TransformGesture(); | |
| transformGesture.events.listen(GestureEvent.GESTURE_BEGAN, onTransformGesture); | |
| transformGesture.events.listen(GestureEvent.GESTURE_CHANGED, onTransformGesture); |
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
| for(layer in map1.layers) { | |
| if(layer.name == 'collider') { | |
| layer.visible = false; | |
| } | |
| } |
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
| override function config(config:luxe.AppConfig) { | |
| config.preload.textures.push({ id:'assets/star.png' }); | |
| config.preload.textures.push({ id:'assets/ship.png' }); | |
| config.preload.textures.push({ id:'assets/beam.png' }); | |
| return config; | |
| } //config |
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
| // -=COLLISION RESOLUTION =- | |
| results = Collision.testShapes(sprite_collider, Main.block_collider_pool); | |
| for(collision in results) { | |
| trace(collision.unitVector); | |
| if(draw_collider) { | |
| debug_text.visible = true; | |
| debug_text.text = 'separation: ' +collision.separation; | |
| } else { | |
| debug_text.visible = false; | |
| } |
NewerOlder