haxeflixel / flixel-addons Goto Github PK
View Code? Open in Web Editor NEWAdditional classes for HaxeFlixel
Additional classes for HaxeFlixel
Following a vanilla install of flixel, flixel-addons and flixel tool demos, following the guide on the homepage results in the TiledEditor failing due to an issue with Flixel addons using legacy code.
I fixed it locally with :
TiledObject [137]
points.push( new FlxPoint(Std.parseFloat(pair[0]), Std.parseFloat(pair[1])));
Probably best to have it in flixel-addons, although I guess it could be made part of the core text class if it's useful enough. I'll have to have a closer look.
http://forums.flixel.org/index.php?topic=8364.msg42162;boardseen#new
For the new state change transitions, it would be cool if in addition to those, you could also force a transition to happen whenever. Like if you want a fade out+in to happen when you move to a new level, there's probably not a state change involved. @larsiusprime
When trying to use FlxTilemapExt in my project, I am getting the following error:
C:\HaxeToolkit\haxe\lib\flixel-addons/git/flixel/addons/tile/FlxTilemapExt.hx:15
7: characters 55-70 : Unknown identifier : _cachedGraphics
C:\HaxeToolkit\haxe\lib\flixel-addons/git/flixel/addons/tile/FlxTilemapExt.hx:39
5: characters 54-70 : Unknown identifier : _region
C:\HaxeToolkit\haxe\lib\flixel-addons/git/flixel/addons/tile/FlxTilemapExt.hx:39
8: characters 22-35 : Unknown identifier : _region
C:\HaxeToolkit\haxe\lib\flixel-addons/git/flixel/addons/tile/FlxTilemapExt.hx:40
0: characters 22-35 : Unknown identifier : _region
C:\HaxeToolkit\haxe\lib\flixel-addons/git/flixel/addons/tile/FlxTilemapExt.hx:40
0: characters 54-70 : Unknown identifier : _region
C:\HaxeToolkit\haxe\lib\flixel-addons/git/flixel/addons/tile/FlxTilemapExt.hx:40
1: characters 10-23 : Unknown identifier : _region
C:\HaxeToolkit\haxe\lib\flixel-addons/git/flixel/addons/tile/FlxTilemapExt.hx:40
1: characters 4-23 : Float should be Int
C:\HaxeToolkit\haxe\lib\flixel-addons/git/flixel/addons/tile/FlxTilemapExt.hx:40
4: characters 29-43 : Unknown identifier : _region
C:\HaxeToolkit\haxe\lib\flixel-addons/git/flixel/addons/tile/FlxTilemapExt.hx:40
4: characters 50-64 : Unknown identifier : _region
I tried to revert to a commit before theses variables showed up, but too much has changed since then. If there is a better method for using Tilemaps, then I am all ears.
https://github.com/Beeblerox/TypeText/blob/master/source/TypeText.hx
Needs to be updated to work with the current HaxeFlixel version. Probably could also needs some other improvements.
I'm trying to run some of the demos provided for Haxe Flixel, but am hitting some dead ends trying to install the required libraries. For example:
TiledEditor mantic$ openfl test Project.xml flash
Error: Library flixel-addons is not installed : run 'haxelib install flixel-addons'
TiledEditor mantic$ haxelib install flixel-addons
No such Project : flixel-addons
Any help?
Need to rename the package flixel.addons.editors
to flixel.addons.format
because:
tmx
instead concrete editors.I ported Funstorm FlxMovieClip (http://www.funstormgames.com/blog/2011/09/flxmovieclip/) to HaxeFlixel. But now this works only in Flash. Maybe someone help me?
package ;
import flash.display.BitmapData;
import flash.display.MovieClip;
import flixel.FlxSprite;
import flixel.FlxG;
import flixel.FlxCamera;
import flixel.util.FlxColor;
/**
* FlxMovieClip
*
* With this you can draw a Flash MovieClip just like an FlxSprite!
* (with a couple of exceptions)
*
* WARNING! Processing intensive - only use when desired effect is
* impossible to achieve with FlxSprite or FlxG.stage.addChild().
*
* Supported methods / properties:
* - x ,y, angle, scale, offset, velocity, acceleration
* - antialiasing, visible, flash movieclip animations
*
* Unsupprted methods / properties:
* - alpha, blend, replaceColor, stamp, drawLine, fill
* - active, flixel animations
*
* @version 1.0 - September 25th 2011
* @link http://www.funstormgames.com/
* @author Wolfgang @ Funstorm Ltd
*/
class FlxMovieClip extends FlxSprite
{
/**
* Internal, the <code>MovieClip</code> being rendered.
*/
private var _mc:MovieClip;
/**
* Internal, bitmapdata which the <code>MovieClip</code> is rendered to.
*/
private var _mcBitmapData:BitmapData;
/**
* Internal, used to keep track of the last <code>MovieClip</code> frame shown.
*/
private var _mcLastFrame:Int;
/**
* Change this to false/true to start/stop the <code>MovieClip</code>.
* Can also use to check whether or not currently playing.
*/
public var isPlaying(get, set):Bool;
private var _isPlaying:Bool = false;
/**
* Whether or not the <code>MovieClip</code> should restart at tbe beginning when it finishes playing.
*/
public var isLooping:Bool;
/**
* A function that gets called every time the <code>MovieClip</code> reaches the end of the timeline.
*/
public var callbackOnComplete:Void -> Bool;
/**
* Creates an empty <code>FlxMovieClip</code> at the specified position.
*
* @param X The initial X position of the sprite.
* @param Y The initial Y position of the sprite.
*/
public function new(X:Int = 0, Y:Int = 0)
{
super(X, Y);
}
/**
* Load a <code>MovieClip</code> from an embedded file.
*
* @param TheMovieClip The <code>MovieClip</code> you want to use.
* @param Width The <code>MovieClip</code>'s width.
* @param Height The <code>MovieClip</code>'s height.
* @param IsLooping Whether or not to loop the <code>MovieClip</code> when playing.
* @param AutoPlay Whether or not to start playing the <code>MovieClip</code> right away.
* @param CallbackOnComplete This function gets called every time the <code>MovieClip</code> reaches the end of its timeline.
*
* @return This <code>FlxMovieClip</code> instance (nice for chaining stuff together, if you're into that).
*/
public function loadMovieClip(TheMovieClip:MovieClip, Width:Int, Height:Int, IsLooping:Bool = false, AutoPlay:Bool = false, ?CallbackOnComplete:Void -> Bool = null):FlxMovieClip
{
_mc = TheMovieClip;
width = Width;
height = Height;
isPlaying = AutoPlay;
isLooping = IsLooping;
callbackOnComplete = CallbackOnComplete;
return this;
}
/**
* Check whether the <code>MovieClip</code> is playing.
*/
private function get_isPlaying():Bool
{
return _isPlaying;
}
/**
* Start / stop playing the <code>MovieClip</code>.
*/
private function set_isPlaying(Play:Bool):Bool
{
if (Play) _mc.play();
else _mc.stop();
return _isPlaying = Play;
}
/**
* Check whether the <code>MovieClip</code> has finished playing.
*/
override public function update():Void
{
if (isPlaying) {
if (_mc.currentFrame == _mc.totalFrames || _mc.currentFrame < _mcLastFrame) {
if (isLooping) _mc.gotoAndPlay(0); // loop back to beginning
else {
_mc.gotoAndStop(_mc.totalFrames-1); // go to last frame
isPlaying = false; // and stop
}
if (callbackOnComplete != null) { callbackOnComplete(); }
}
_mcLastFrame = _mc.currentFrame;
}
}
/**
* Draw the <code>MovieClip</code> to the camera buffer.
*/
override public function draw():Void
{
// This class is mostly copied over from FlxSprite.
// Comments are next to any lines changed.
if (_mc != null) { // Only draw if a movieclip has been loaded
// create a new bitmap data with a transparent background
// this is necessary because otherwise the movieclip frames get drawn on top of each other
// (drawing on top works fine for movieclips with an opaque background but of course is a major problem for MCs with a transparent BG)
_mcBitmapData = new BitmapData(Std.int(width), Std.int(height), true, 0);
// draw the movieclip to the bitmapdata so we can draw it to the camera later
_mcBitmapData.draw(_mc);
if(cameras == null)
cameras = FlxG.cameras.list;
var camera:FlxCamera;
var i:UInt = 0;
var l:UInt = cameras.length;
while(i < l)
{
camera = cameras[i++];
if(!isOnScreen(camera))
continue;
_point.x = x - Std.int(camera.scroll.x * scrollFactor.x) - offset.x;
_point.y = y - Std.int(camera.scroll.y * scrollFactor.y) - offset.y;
_point.x += (_point.x > 0) ? 0.0000001 : -0.0000001;
_point.y += (_point.y > 0) ? 0.0000001 : -0.0000001;
_matrix.identity();
_matrix.translate( -origin.x, -origin.y);
_matrix.scale(scale.x, scale.y);
if ((angle != 0) && (bakedRotationAngle <= 0))
_matrix.rotate(angle * 0.017453293);
_matrix.translate(_point.x + origin.x, _point.y + origin.y);
camera.buffer.draw(_mcBitmapData,_matrix,null,blend,null,antialiasing); // where the magic happens: the bitmap data gets drawn to the camera
}
}
}
/**
* Clean up memory.
*/
override public function destroy():Void
{
_mc = null;
_mcBitmapData = null;
callbackOnComplete = null;
super.destroy();
}
/**
* Can't use graphics of type Class with FlxMovieClip.
*/
override public function loadGraphicFromSprite(Sprite:FlxSprite):FlxSprite
{
return null;
}
/**
* Can't use graphics of type Class with FlxMovieClip.
*/
override public function loadGraphic(Graphic:Dynamic, Animated:Bool = false, Width:Int = 0, Height:Int = 0, Unique:Bool = false, ?Key:String):FlxSprite
{
return null;
}
/**
* Can't use graphics of type Class with FlxMovieClip.
*/
override public function loadRotatedGraphic(Graphic:Dynamic, Rotations:Int = 16, Frame:Int = -1, AntiAliasing:Bool = false, AutoBuffer:Bool = false, ?Key:String):FlxSprite
{
return null;
}
/**
* Can't use graphics of type Class with FlxMovieClip.
*/
override public function loadGraphicFromTexture(Data:Dynamic, Unique:Bool = false, ?FrameName:String):FlxSprite
{
return null;
}
/**
* Can't use graphics of type Class with FlxMovieClip.
*/
override public function makeGraphic(Width:Int, Height:Int, Color:Int = FlxColor.WHITE, Unique:Bool = false, ?Key:String):FlxSprite
{
return null;
}
}
It seems that the problem comes from the library we are using, that is spinehx, and this library seems not active anymore.
There is another Spine runtime here spinehaxe
Reports come from this tweet.
/usr/lib/haxe/lib/flixel-addons/git/flixel/addons/editors/tiled/TiledObject.hx:137: characters 15-27 : flixel.util.#FlxPoint has no field get
Discovered when messing with tiled demo.
haxeflixel Version: 3.2.2
flixel-addons Version: 1.0.3
lime Version: 0.9.6
Would probably use Haxe remoting unless OpenFL has some functionality that would make this easier. Could be a dedicated class like FlxMultiplayer
or something, but would probably need both server and client code.
Need support isometry format in tmx
tilemaps.
Hi, i had this problem before and after updating flixel-addons it happened again.
when i use flixel-addons, my projects fail to compile (even new ones from template), due to this line:
haxelib.json line:10
"dependencies": { "openfl": "", "flixel": "", "systools": "1.1.0" }
if i replace the dots with commas:
"dependencies": { "openfl": "", "flixel": "", "systools": "1,1,0" }
it all works fine and i can compile the projects, otherwise it says flixel-addons can't be found.
Hi, is there any particular reason why FlxNestedSprite can contain only other FlxNestedSprites?
I think it's elementary for most games. Should add a lot to the framework if done in the correct way (a UI element so all the windowing, texts and localization can be easily handled).
Justin Edwards already has something for it
I also like this tutorial
Kevin has made a dialog system
Flash target (expected results across targets) on top, android (notice the unwanted horizontal offset) on the bottom. For some reason it seems like sprites are offset farther with higher skew.
This is the sprite I use:
and code:
origin.set(0, 0);
setPosition(Math.floor(startX), startY);
scale.x = (Math.ceil(endX) - Math.floor(endX)) / 8; // sprite is 8 pixels wide
skew.y = Math.atan2(endY - startY, endX - startX) * 180 / Math.PI; // calculate skew angle
I proposed this fix in the forums but SruloArt told me that is better to open an Issue here.
FlxTrail is not working with animated sprites. I prefer to use FlxTrail instead of FlxTrailArea because it's faster if I only have to do the trail of one sprite.
This is an example project to see the problem and test the fix https://dl.dropboxusercontent.com/u/24695185/TestAnimatedTrail.rar
This is the proposed fix
Line 81 added:
/**
* Stores the sprites recent animations.
*/
private var _recentAnimations:Array;
in new()
_recentAnimations = new Array();
in destroy()
_recentAnimations = null;
in update:
// Again the same thing for Sprites frames if framesEnabled
if (framesEnabled && _image == null)
{
var spriteAnimation:FlxAnimation = sprite.animation.curAnim;
_recentAnimations.unshift(spriteAnimation);
if (_recentAnimations.length > _trailLength)
{
_recentAnimations.pop();
}
var spriteFrame:Int = sprite.animation.frameIndex;
_recentFrames.unshift(spriteFrame);
if (_recentFrames.length > _trailLength)
{
_recentFrames.pop();
}
var spriteFacing:Int = sprite.facing;
_recentFacings.unshift(spriteFacing);
if (_recentFacings.length > _trailLength)
{
_recentFacings.pop();
}
}
// Now we need to update the all the Trailsprites' values
var trailSprite:FlxSprite;
for (i in 0..._recentPositions.length)
{
trailSprite = members[i];
trailSprite.x = _recentPositions[i].x;
trailSprite.y = _recentPositions[i].y;
// And the angle...
if (rotationsEnabled)
{
trailSprite.angle = _recentAngles[i];
trailSprite.origin.x = _spriteOrigin.x;
trailSprite.origin.y = _spriteOrigin.y;
}
// the scale...
if (scalesEnabled)
{
trailSprite.scale.x = _recentScales[i].x;
trailSprite.scale.y = _recentScales[i].y;
}
// and frame...
if (framesEnabled && _image == null)
{
trailSprite.animation.curAnim = _recentAnimations[i];
trailSprite.animation.frameIndex = _recentFrames[i];
trailSprite.facing = _recentFacings[i];
}
// Is the trailsprite even visible?
trailSprite.exists = true;
}
If I try to change the color of a FlxNestedSprite nothing happens. This is a test code:
var spr1:FlxNestedSprite = new FlxNestedSprite(30, 30);
spr1.makeGraphic(20, 20);
add(spr1);
var spr2:FlxNestedSprite = new FlxNestedSprite(20, 20);
spr2.makeGraphic(10, 10);
spr1.add(spr2);
spr1.color = FlxColor.RED;
My solution was to comment out the set_color() function override.
I wanted to add a pause feature to my FlxNapeState but simulation was still working when i did the super.update();
Basically i added a pause boolean in the FlxNapeState and changed this line:
if (!pause) {
space.step(FlxG.elapsed, velocityIterations, positionIterations);
}
it would be nice to have this.
Pretty simple to recreate: Just add a FlxBackdrop to a state and set RepeatX and RepeatY to false, build for Windows and watch the backdrop repeating. It does not in flash.
In the "create" function for FlxNapeState one line tries to create a debug button for the nape debug view (line 90)
There are multiple problems with this:
The fix isn't difficult, I just have to know what icon should be used and where it would have to be placed. Would the user have to copy the file over or is there a way to put it somewhere outside the project folder?
Inside FlxExtendedSprite.hx, mouseStartDragCallback
and mouseStopDragCallback
do not fire. They can be set, but are never read except to be set to null in disableMouseDrag()
.
Citrus engine has an interesting integration with Flash Pro,
Tiled has custom properties which you can use
And even Openfl have a notable mention with GameStudioHx
But HaxFlixel stands alone.
Not alone. How about using Krita(/Gimp) + Spriter(/Spine) to do all the hard work and then let HaxFlixel read and implement the X/Y/Width/Height and ANIMATION info for you? Here's how I think it can work:
Need support to load external tsx
-files linked to tmx
-files. Maybe like assets loading.
E.g.: perspective_walls.tmx
<tileset firstgid="1" source="perspective_walls.tsx"/>
name
attrsource
attrThis rules means that we need to load a tsx
from a directory that contains the our tmx
.
If tsx
isn't exist then we need call something like this:
loadExternalTileset(filename, success:String->Void)
.
Edit: _The List_: here, at the bottom page under "Flixel's Potential Addons"
Keep an eye out for more potential addons classes / libraries that can be useful to HaxeFlixel. If you find or look for anything like that, you can either reference it here so I can add it to my ever growing list, or you can browse the list to choose a potential addon to port / integrate to the addons folder.
The addons folder is meant to store useful, but not "core" material classes so it won't be lost. Now:
Flixel-Plus, Flixel-Plugins, HaxeFlixelPG [as far as I recall], stuff like Tim's Z-sorting class, or the Gamepad class from the forum not so long ago. There are many, many games out there with great ideas, forgotten Flx----.as3 classes that are easily converted with great functionalities and more.
@kevinresol, af570b5 is a massive breaking change (just switched from the haxelib version to dev), but I can't find any updated documentation to explain the new methodology. For instance, I used to use makeImageBullet()
to create the bullet and add it to the group. Is the new approach to put all the creation code into the game itself?
Around the same time you introduced a bulletFactory (f704576), I'd really like to see some example code that uses this. There's nothing in the demos, so I'm kinda struggling - I got up and running using the original docs on http://www.photonstorm.com/flixel-power-tools/flxweapon.
A couple of other questions / thoughts:
angleNoise
be required for methods like fireFromParentFacing()
? Just means the code now has to have new FlxBounds(0, 0)
whenever you call it.setFirePosition()
is gone, and it looks like positionOffset
(used to be _positionOffset
) isn't being used. How do I get my bullet to fire from an offset of the parent position (or any specific position, tbh)?Any help would be appreciated :)
Cheers,
Mark
http://haxe.org/manual/lf-static-extension.html
Probably I'm missing something really obvious (It's one of my best qualities), but why isn't this a thing? :
Using FlxSprite.NapeExt;
This can be used to minimize and extend the regular classes with several "skins" simultaneously, e.g.
Using FlxSprite.NapeExt; // For Physics.
Using FlxSprite.BrainExt; // For AI.
Using FlxSprite.ControlsExt; // and so on...
Hey guys, I was wondering if someone could help me at all on the FlxTilemapExt slope help. I noticed that in the demo, it is something along the lines of
level.setSlope(etc etc etc etc);
I tried installing the flixel git, and used flixel addons to try it, but it didn't work. Is there something I'm doing wrong, or does the demo use different versions? (Sorry for the lack of information, I'll give a more detailed response if needed)
In a customized version of crashdumper, I dump a screenshot on crash, using FlxScreenGrab.
Here's FlxScreenGrab's output:
Here's the system's native PrintScreen:
The FlxScreenGrab image's tileset has little artifacts in it -- perhaps because I'm using the "tileset smear trick" where you add borders to each tile to avoid cross-tile bleed. Also note that the flixel-ui elements are arbitrarily offset from the native screenshot.
FlxScreenGrab just looks like it does a naked draw dump from the stage, so how is this discrepancy even happening? It should be using the same draw logic as everything else, right?
https://github.com/Masadow/AxonometricHaxe
@Tiago-Ling is currently working on this: https://github.com/Tiago-Ling/AxonometricHaxe
Not sure if this is even anything you can help with, but I just started noticing this problem, and I'm not sure how to fix (it's probably something dumb and simple).
I'm using the Tiled editor files, setup almost identically to the demo.
I'm making my maps in Tiled as Base64 (uncompressed), and I have animated tiles and everything works just fine... until I commit my changes to GitHub.
When I go to another computer and sync, if I immediately try to run my project, it dies with an error about "Encountered End of File" on line #231 of TiledLayer.hx.
If I then go into the Tiled Editor, load my Tmx file, it loads just fine, and then after I save it in Tiled (without making any changes), it works in my project again without any errors...
Until I commit it back to GitHub again and grab the changes from another computer...
Is this something that can be fixed within TiledLayer? Or something I'm doing wrong? Any suggestions?
I was testing the FlipRotationAnimationTiles demo and found that the rendering is broken on cpp and neko targets. In flash it works ok. It was working before. Might be a flixel issue.
The API docs show that there is a createBulletPattern function. I checked the code and it's nowhere to be seen. It sounds like a cool idea though. I'll work on it since I need it for my game.
Create a property to represent the global trail's alpha. The alpha of every FlxSprite in FlxTrail should be multiplied by this value so the whole trail's transparency can be faded-in/out whithout changing original FlxSprite's alpha.
FlxMouseControl
only looks at FlxG.mouse.pressed
which indicates left mouse button clicks.
For right and middle button, there currently is the FlxG.mouse.pressedRight
and the FlxG.mouse.pressedMiddle
available. It'd be nice to have FlxMouseControl
handle these buttons as well and let the callbacks have an event object parameter telling which button was pressed.
First, watch this (in case you haven't already): https://www.youtube.com/watch?v=y-chi097uV4. Now, die a little inside because HaxeFlixel is not that engine. But wait, with some tweaks it can look like it! well, maybe from a far far away place, with blurry glasses, viewed by an elderly lady with cataract and a evil cat. But I digress.
Reference for the reflection effect:
It can be a pretty nice effect to have, not necessarily just for water effects...
Hey guys, I noticed that in the FlxTilemapExt, slopes are not working correctly...
I try to add slopes to my level, which is in the code here
// Setting the slopes of the map
var slopeFL:Array<Int> = [10];
var slopeFR:Array<Int> = [9];
var slopeCL:Array<Int> = [11];
var slopeCR:Array<Int> = [12];
level1.setSlopes(slopeFR, slopeFL, slopeCR, slopeCL);
I notice how the help says that in setSlopes, this is how it is supposed to function
setSlopes (?LeftFloorSlopes:Array<Int>, ?RightFloorSlopes:Array<Int>, ?LeftCeilSlopes:Array<Int>, ?RightCeilSlopes:Array<Int>) : Void …
Sets the slope arrays, which define which tiles are treated as slopes.
Although, if you look at my code above, I put the right one first, then the left one. I tried doing it as the help said it, but it inverted it and made left to right and right to left. Someone needs to fix this, either edit the help to say it is right first, or change the way the setSlopes works.
Thanks,
Dan.
When I try to use animated tiles, only a quarter of them show up. The rest stand still, as if they weren't animated at all. I checked the XML I was loading from and all, and this issue still doesn't make any sense.
SWF:
http://www.fastswf.com/XRK-VOA
Gist:
https://gist.github.com/Ohmnivore/d68d73da0844afbc39fd
I think you guys change the Flxel.Utils structures but you didn't change in flixel-addon.
So It's called 'class not found' with every line of those.
FlxSprite uses degrees for rotation angle, so when FlxWeapon:internalFireFromAngle() is eventually called from FlxWeapon.fireFromParentAngle(), it will be passing in an angle in degrees. Unfortunately the code in internalFireFromAngle() assumes the angle is in radians. There's no way to coerce the parent sprite's facing angle or rotation angle to be radians, so this functionality does not work at all.
This is discussed in #103 (cc @kevinresol), but that is getting overloaded.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.