Haxe Game Development Essentials by Jeremy McCurdy

Haxe Game Development Essentials by Jeremy McCurdy

Author:Jeremy McCurdy [McCurdy, Jeremy]
Language: eng
Format: azw3
Publisher: Packt Publishing
Published: 2015-11-26T05:00:00+00:00


As discussed before, we make a new TexturePackerData object and then use it to load graphics into our FlxSprite objects. We'll also be setting the visible property of the sprites to false so that we can play out the muzzle flash animation sequence.

Playing the flash

Let's build the function that will get called when the muzzle flash needs to get played. Like the explosion effect's play function, this is a public function, and it takes in x and y coordinates:

public function playFlash(x:Float, y:Float):Void { flash.setPosition(x + flashXOffset, y + flashYOffset); rings.setPosition(x + ringsXOffset, y + ringsYOffset); flash.scale.y = 0; flash.scale.x = 0; flash.alpha = 1; flash.visible = true; FlxTween.tween(flash.scale, { x:1,y:1 }, 0.1, { ease: FlxEase.quadIn,complete: showRings} ); }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.