GithubHelp home page GithubHelp logo

adamatomic / flixel Goto Github PK

View Code? Open in Web Editor NEW
1.1K 1.1K 197.0 9.84 MB

flixel is a free Actionscript (Flash) library that I distilled from a variety of Flash games that I've worked on over the last couple years, including Gravity Hook, Fathom and Canabalt. It's primary function is to provide some useful base classes that you can extend to make your own game objects.

Home Page: http://www.flixel.org/

License: Other

ActionScript 89.46% Shell 0.03% JavaScript 9.53% Python 0.98%

flixel's People

Contributors

adamatomic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flixel's Issues

FlxU.setWorldBounds

I'm experiencing a couple issues with setWorldBounds. When I let FlxG.followBounds run it with settings that probably don't completely contain all objects being collided with, collisions work but with severe lag. If I execute the function in a way that contains all the objects being collided, there is no slowdown, but nothing collides.

Player sticks to y of moving platform

I pulled the latest Flixel today, and a weird and quite important bug arose. I have moving platforms, and if my player jumps under a platform going down, he sticks to the y and goes down with the platform. I also can't jump if the platform is going down...

There's lot's of code related, but the basics are that I can jump through the platform:

    override public function hitCeiling(Contact:FlxCore=null):Boolean
    {
        if(Contact is FallBlock || Contact is MovingBlock)
        {
            return false;
        }


        else
        {
            return super.hitCeiling();
        }
    }

I use a simple boolean trigger in the hitfloor function (method?) so my player can jump. In the player update function (method?), after super.update(); I use if(this.y !=0){jump=false); so basically the hitfloor trigger gets processed first and my player can jump if on a moving platform... Not sure if this is clear though.

I also use this in the hit floor so my character doesn't snap on platforms:

            if(last.y+(height-2) > Contact.y)
            {
                return false;
            }

Anyway. If you need more code just ask, or maybe the last commit wasn't 100% stable stuff? I reverted to 1.54.

[Flx 1.54] BUG - Weird collision behaviour when changing width/height of sprite

I'm doing some tests on Whacky Whacky (for Flan export) and found out that, differently from the 1.25, the 1.54 weirds up heavily when changing width/height of an object.

Previous behaviour (1.25): http://www.tbam.com.ar/play--whacky-whacky.php
New behaviour (1.54): http://www.swfcabin.com/open/1264609275

What's going on?
Hehehe

[CODE, The size adjusting snippet]
protected function adjustPlayerSize():void
{
player.offset.x=Math.floor(16-(_player.scale.x - 1)/2);
player.offset.y=Math.floor(16-(_player.scale.y - 1)/2);

        _player.width=16*(_player.scale.x);
        _player.height=16*(_player.scale.y);
    }

[/CODE]
[CODE, the growing snippet]
_player.scale.x+=0.15;
_player.scale.y+=0.05;
adjustPlayerSize();
[/CODE]

Regards

Tilemap callbacks not always being called

The issue can be experienced when, for instance, the player character in a platformer is standing with one foot on one tile, and another on a different tile; if both these tiles had a callback set, only the left tile's will be triggered.

It took me a while to discover the cause for the issue, since I'm not an experienced programmer, but I did find it. When one uses a tilemap's collide() function, it calls collideX() and collideY() for every block that could be colliding against the passed core. The problem lies in these two, which modify the core's position; so, if we're iterating between the two blocks at the abovementioned character's feet, the leftmost block will trigger a collision (since the sprite is at that time actually falling through it), and in the process move the sprite's position upwards so it's not colliding any longer; therefore, when a collision check is attempted for the second block, it will return false and not perform the callback.

Moving FlxGroup objects don't collide properly.

I've got a player made of multiple sprites in a FlxGroup. The FlxGroup has a y acceleration, and causes severe lag (around 7 FPS) as it falls downward over the FlxSprite it is supposed to collide with. Overlap works just fine, as I have a FlxTileblock that kills the player when it moves off screen. When that happens the framerate jumps to 60.

Cursor management of FlxG needs improvement

The current implementation of FlxG.showCursor() and FlxG.hideCursor() is a bit awkward, because FlxG.showCursor(ImgCursor) can not be used to change the graphic of the cursor before removing the previous one with a call to FlxG.hideCursor().

Furthermore, FlxG.showCursor() can't be called in the constructor of FlxGame's instance to define a standard cursor, because the FlxGame instance won't have its _buffer set before the first onEnterFrame event is triggered by Flash.

Suggestions:

  1. Add a method "setCursorGrapic()" to FlxG, which handles the setting of a cursor graphic independent from showCursor() - just have showCursor() call setCursorGraphic() when called with a parameter for backward compatibility.
  2. Make showCursor() check whether a cursor is already active and whether _buffer actually exists.
  3. Have a private property on FlxG that reflects the visibility state of the cursor
  4. In FlxGame.onEnterFrame(), when it creates the _buffer, also "addChild" the cursor if the property from (3) declares it as visible.

FlxTilemap collision issues

I just noticed that if you try to collide a FlxCore with a FlxTilemap and the FlxCore is partially outside the tilemap there is a possible bug. If the FlxCore hits a solid tile inside the tilemap, the FlxCore will jump and get stuck inside the tilemap.

The way around this currently (v1.5) is to add a buffer zone of non-collideable tiles around the edges of a tilemap so your FlxCore is safetly inside before it can collide with any solid tiles.

Changing position x/y of FlxLayer does not change position of children

It seems there's a bug when setting the position (x/y) of an FlxLayer. If you try to do this, nothing happens - any sprites, buttons, on the layer don't get moved.

Turns out in FlxLayer.update(), super.update() should be at the end instead of the start of the function, due to the way FlxCore.last is used.

I've made this change locally and it seems fine.

[1.43] Problems with scrolling buttons

I've set a button's scroll factor to 0 (using the synch-scroll-with-layer thing). But the button still scrolls around the screen, and highlights when you put the mouse over it. However nothing happens when you click it, if it's moved; the clickable area stays where it should be.

One problem seems to be that the mouse coordinates from FlxG are relative to scrollfactor(0,0); maybe it would be good to have mouse coordinates relative to a layer or sprite accessible from that layer or sprite? Anyway, in my own version of the button class I changed this in the mouseover section. I also set the scrollfactor of the graphic and text to be (0,0) wherever made sense, and changed the overlapspoint so that it used the button rather than the off graphic.

These changes now work for fixed buttons, but still not for scrolling buttons. I think the reason is that I haven't understood how updatepositions works; the scrollfactor stuff above may be a red herring.

There's another problem I've been getting, which is that the default button graphic is a long white rectangle with no mouseover, and a small white square with mouseover. I don't think this is what's meant to happen, but haven't managed to fix it. One suspect is the createBitmap function in FlxG, which looks like it might have some typos in it.

32x16 Image for FlxBlock

Hello, when using a 32x16 image for a 32x16 block, the visual output is random. Sometimes the block is twice the left 16x16 tile, sometimes the other half doubled, sometimes the good image... This is different per FlxBlock in the state.

I'm not sure what more info I can say... this is a pretty basic moving platform, and the blocks are added to an array in my LevelState.

doFollow doesn't center the followed sprite properly

this seems to fix it for me:

_scrollTarget.x = (width>>1)-followTarget.x-(followTarget.width>>1)+(followTarget as FlxSprite).offset.x;
_scrollTarget.y = (height>>1)-followTarget.y-(followTarget.height>>1)+(followTarget as FlxSprite).offset.y;

Need an isPlaying property for FlxSound, or make play()/pause()/stop() virtual

I'm writing a tool for creating adaptive music running on top of Flixel with FlxSound, and it requires a way to tell if a sound is currently playing or not. Could we to add an isPlaying property to FlxSound, or make the play(), pause(), and stop() functions public so that it's possible add this functionality in ourselves?

I'm already maintaining my own copy of Flixel, edited to make the functions virtual, but I get the feeling I'm not the only one who would make use of this.

Thanks for an awesome framework!

Changing FlxText's width

Since there's still no getter/setter for width in FlxCore, changing width in a FlxText doesn't change the underlying TextField.width as it should, so even if you change the width after it's been created, text ends up being cropped.

small fix

In FlxTilemap.as (setTileByIndex), line 191, > should be >=

FlxSound: Get mp3 ID3 tag from streaming sounds

Minor suggestion:

Change logic in FlxSound to do something like:

_sound = new Sound();
_sound.addEventListener(Event.ID3, id3Get);
_sound.load(new URLRequest(SoundURL));

and add a new function:

private function id3Get(event:Event):void
{
SongName = _s.id3.songName;
HasName = true;
}

The purpose of "HasName" is that it might take a few ms to get the songname after streaming is started, so in a loop (like in update), just keep checking if (HasName) FlxG.log(SongName); or something.

Problems with FlxSave

Not a bug per se, but I was bewildered today when my project started crashing suddenly at runtime for me, but worked fine for everyone else. Also, it didn't happen when I was testing locally, only when I uploaded it to my server. I finally tracked the problem down to my save and load routines, and I think it turned out to be some problem with the shared object...

Since I'm new to Flash, I'm not familiar with what it might have been. Maybe I exceeded the maximum size (which I find strange since it hardly reaches 1kb of data and my maximum was set to 100kb at the time). I also didn't get any window asking for permission to allocate more space or anything, just a runtime crash... But allocating some more space manually, and then reverting it back to what it was before, magically solved the problem...

Having this in mind, I think FlxSave should be expanded slightly, so that it adds a bit of more control, specifically so that it informs the user (a boolean return would be sufficient) whether a read or write was successful, and to enable setting a minimum file size (via flush's parameter). This way we could at least handle failures gracefully instead of crashing a bit later on.

FlxTilemap feature requests

Hi, here are a few suggestions I'd like to make for FlxTilemap:

  • getTile() function.
  • support for non-square tiles, width and height instead of size (for example, my game Charlie the Duck uses tiles of 20x16 pixels).
  • when reading maps, allow the value -1 (or 0xffffffff) for empty/nothing, or... use Int values when comparing with CollisionIndex and DrawIndex, or even better... add a base / skip value that says what number the first tile in your tileset should be (by default 0, but I would normally set this to the same value as DrawIndex). That way you wouldn't have to add dummy tiles at the beginning of your tileset and it would make it easier to use output from Tile Studio).
  • option to have the entire map be repeated horizontally and/or vertically (this is very useful for background layers where you make one screen and let it repeat).

Mouse cursor "twitching" during scrolling

If the camera scrolls and a mouse cursor is displayed, it isn't static but "twitching" 1 pixel. Reason is in FlxGame.onEnterFrame():

            if(_cursor != null)
            {
                _cursor.x = FlxG.mouse.x + FlxG.scroll.x;
                _cursor.y = FlxG.mouse.y + FlxG.scroll.y;
            }

Since FlxG.scroll.* is a float and not Math.floor()'ed, it can cause rounding errors. Problem was fixed when I put Math.floor() around those.

Key for developer console not working on German keyboard

(event.keyCode == 192) only works on US keyboard layout. The keyCode for that key on a German keyboard layout is "220".

Since that number collides with another key on the US layout, the safest way to support both layouts would be to check the charCode too, which is different on the US layout:

if(event.keyCode == 192 || event.charCode == 220 && event.keyCode == 220)

First line in definition of FlxGame.onKeyUp()

FlxTilemap should only overlap colliding tiles.

It'd be cool if one of two things would happen:

  • FlxTilemap.overlaps() would only return "true" if the argument overlapped a colliding tile
  • FlxTilemap got a function called something like overlapsCollidingTile() that does the above.

As it is, overlaps() returns true if the argument overlaps the entire tilemap, which isn't all that useful.

FlxButton.onMouseUp(): redundant scroll-normalization

I had a FlxButton on a UI Element which is on a layer set to scrollFactor = (0,0) and discovered that the button's click area was not where it was supposed to be when the camera was scrolled (i.e. FlxG.scroll != (0,0). Tracking the error, I discovered that in FlxButton.onMouseUp an overlapsPoint check was made with the mouse coordinates being normalized to a scrollFactor == (1,1) layer.

Problem is, overlapsPoint() does the same normalization again on the coordinates which are passed to it, so basically it does it twice, which is the cause for the problem. Altering

            if(_off.overlapsPoint(FlxG.mouse.x+(1-scrollFactor.x)*FlxG.scroll.x,FlxG.mouse.y+(1-scrollFactor.y)*FlxG.scroll.y)) _callback();

to

            if (_off.overlapsPoint(FlxG.mouse.x, FlxG.mouse.y)) _callback();

made the button behave correctly.

Adding support for generation of pre-rotated spritesheets.

The idea is to modify the FlxSprite:loadGraphic() method so that you can pass the number of rotations you want(replacing the Reverse parameter).

This implies modifying the FlxG:addBitmap(), FlxSprite:render() and FlxSprite:calcFrame() methods.

Here's the function that creates the rotation spritesheet from the original spritesheet, I'm sure there's a lot of room for improvement:

/**
 * Creates a spritesheet with all the rotated frames
 * 
 * @param   bmd             The source spritesheet
 * @param   fW              Frame's width
 * @param   fH              Frame's height
 * @param   numRotations    Number of rotations to create(ex:4 rotates for angles: 0,90,180,270)
 * @return  The new spritesheet
 */
static public function rotationsBitmap(bmd:BitmapData,fW:uint,fH:uint,numRotations:uint):BitmapData {

    //the size of each frame must be larger so rotations fit
    var frameSize:int = Math.ceil(Math.max(fW,fH) * Math.SQRT2)
    var tempBMD:BitmapData = new BitmapData(frameSize, frameSize, true, 0x00000000)
    var tempBMD2:BitmapData = new BitmapData(frameSize, frameSize, true, 0x00000000)

    var destP:Point = new Point((frameSize-fW) / 2, (frameSize-fH) / 2)
    var destP2:Point = new Point()
    var rect:Rectangle = new Rectangle(0, 0, 16, 16)
    var rectZero:Rectangle = new Rectangle(0,0,frameSize,frameSize)
    var mat:Matrix = new Matrix()

    var numColumns:uint = bmd.width/fW
    var numLines:uint = bmd.height/fH
    var numFrames:uint = numColumns * numLines

    //we try to make the bitmapdata as wide as possible (< 2800)
    //so its less likely to go over the 2880 pixels limit for BitmapData
    var neededLines:uint = Math.ceil((numFrames * frameSize)/2800)
    var framesPerLine:uint = Math.ceil(numFrames / neededLines)

    var newBMD:BitmapData = new BitmapData(framesPerLine*frameSize,frameSize*numRotations*neededLines,true,0x88880000)

    for (var r:int = 0; r < numRotations; r++){

        mat.identity()
        mat.translate(-frameSize/2,-frameSize/2)
        mat.rotate(r * (Math.PI * 2) / numRotations)
        mat.translate(frameSize/2,frameSize/2)

        for (var i:int = 0; i < numFrames; i++){

            rect.x = (i%numColumns)*fW
            rect.y = Math.floor(i/numColumns)*fH

            tempBMD.fillRect(rectZero,0x00000000)
            tempBMD.copyPixels(bmd, rect, destP)

            tempBMD2.fillRect(rectZero,0x00000000)
            tempBMD2.draw(tempBMD,mat)

            destP2.x = (i%framesPerLine) * frameSize
            destP2.y = (r * neededLines * frameSize) + (Math.floor(i/framesPerLine)*frameSize) 
            newBMD.copyPixels(tempBMD2, rectZero, destP2)
        }   
    }
    return newBMD
}

I suspect there may be a way to reduce the number of needed rotations, dividing it by 4, some hack to flip a frame horizontally or vertically. There has to be a way...

overlaps() not working correctly with parallaxed vs. non-parallaxed sprite

If sprite A has a "regular" scrollFactor of Point(1, 1) and sprite B has anything irregular like Point(1.5, 1.5), overlap detection does not work correctly, because FlxG.scroll values are ignored for A's position.

Current code is:

        var tx:Number = x;
        var ty:Number = y;
        if((scrollFactor.x != 1) || (scrollFactor.y != 1))
        {
            tx -= Math.floor(FlxG.scroll.x*(1-scrollFactor.x));
            ty -= Math.floor(FlxG.scroll.y*(1-scrollFactor.y));
        }
        var cx:Number = Core.x;
        var cy:Number = Core.y;
        if((Core.scrollFactor.x != 1) || (Core.scrollFactor.y != 1))
        {
            cx -= Math.floor(FlxG.scroll.x*(1-Core.scrollFactor.x));
            cy -= Math.floor(FlxG.scroll.y*(1-Core.scrollFactor.y));
        }

What really would make more sense is if it's just checked whether

(scrollFactor.x != Core.scrollFactor.x || scrollFactor.y != Core.scrollFactor.y)

to do the scrolling-compensation.

x and y of FlxButton of no use in update()

I can position the button in create() of the FlxState. I can move it around in update() via velocity and acceleration.

I can not reposition it in update() by setting x and y anew. While a trace() shows that the variable is set, it does not change the position of button on the state.

I helped myself by "button.reset(newX,button.y);", but this is only valid as long the y variable is in sync with the actual position.

Support panel button graphics do not show

I've tried running the setup function from the game level and the state level.

Running setup from state level, I will momentarily see the graphic for Donate and close (they might all be landing at the same location), but the second show runs to place the panel properly, the button vanishes, and the only thing visible on the panel is the caption on the far right side

Despite this, the buttons still function - their hot spots still activate in what seems to be the proper locations, but they show no graphics.

There's no working sample available, so it's unclear at the moment if there is another step between setup and show that is missing.

Separate sprite width/height and collision width/height

I've got a problem in my current game where there is a 16x16 tilemap, and a few 16x16 characters. The characters can't fall through a 16x16 hole in the ground because of rounding. I think that collision width and height should be separated out to their own variables so that the sprites could have 16x16 images, but a collision box of 14x16 or something, but I'm not sure how to go about this myself. I've got a solution right now, but it is pretty messy.

Need Documenation

There should be a nanodoc.html in the root of the repository. This is needed for API changes

FlxTilemap incorrectly handles collision at extremes

I ran into this issue in 1.47, but from the source it appears to still be there. FlxTilemap.preCollide defines ix and iy as uints instead of ints. Because of this, if the colliding object's x or y is less than the tilemap's x or y, the uint overflows and collision works wrong. I'm guessing this doesn't come up much because few people use tilemaps that can be collided with from outside the tilemaps' bounds. Changing ix and iy to ints appears to fix the collision mistakes.

Flixel and Flex 4 - problem with displaying text

If you would like to use Flixel (20.12.2009) and Flex 4 (beta 2), you have to turn on option: Use Flex 3 Compatibility mode, otherwise no letters from FlxText will be displayed.

To turn on compatibility option go to Project Properties - Flex Compiler - Flex SDK Version and check Use Flex 3 Compatibility Mode

[1.56] BUG - Collision problems

Adam, I couldn't quite catch this yet.. but 1.56 introduces some weird bugs while trying to override collision functions (hitWall / hitFloor / hitCeiling), most likely because it completely ignores those functions on your new code.

FlxSound --> "_channel" can cause a null value exception in some cases

if you try to play many many sounds at once (like 60 or so), it appears that the _channel variable can be null and cause a null value exception.

in FlxSound.as line 147 and 157 it's like this:

if(_channel == null)
{
_channel = _sound.play(0, 0, _transform);
_channel.addEventListener(Event.SOUND_COMPLETE, stopped); //<-- _channel can be null here..
}

it works for me if i check for null values again..

if(_channel == null)
{
_channel = _sound.play(0, 0, _transform);
if(_channel != null)  _channel.addEventListener(Event.SOUND_COMPLETE, stopped);
}

would be great if you can add this additional check to prevent this exception.
or i can try to figure out more about this error.

otherwise flixel rocks!! :)

hitRight() calls hitLeft() - line 446 in FlxObject.as

The hitLeft() method works fine, but when I override hitRight() I get hitLeft() behavior as well. I checked in FlxObject.as and hitLeft() looks like this:

public function hitLeft(Contact:FlxObject,Velocity:Number):void
{
if(!fixed)
velocity.x = Velocity;
}

and hitRight() looks like this:

public function hitRight(Contact:FlxObject,Velocity:Number):void
{
hitLeft(Contact,Velocity);
}

_helpStrings

Seems like the _helpStrings variable in FlxGame class is not used anymore (still initialized though).

Best regards

Colliding to FlxTilemap

Hi,
with the recent changes (FlxG.collideArray2 removed) how is it possible to have an array of objects collide to the map? Shouldn't FlxTilemap have a collideArray function? Am I missing something?

FlxTileblock throws a runtime error if you pass it a non-zero Empties value

I fixed the problem in renderBlock() in FlxTileblock.as, line 98:

if(_rect != null) FlxG.buffer.copyPixels(_pixels,_flashRect,_flashPoint,null,null,true);

should be

if(_flashRect != null) FlxG.buffer.copyPixels(_pixels,_flashRect,_flashPoint,null,null,true);

_flashRect is defined the line before, and I can't find _rect defined anywhere.

Previous states still exist after changing states

When the state is changed, it seems that previous states aren't actually removed. Buttons from a previous menu are still click-able, and when testing Mochi leader-boards, I found that the button function that calls the leader-board stuff and sends a score to it is called for every instance of the game state called up previously as well. I was able to tell this by tracing the current game's score in the function called when the button is clicked - the current score would be traced, but so would the scores of every past game played.

[Flx 2.19] Proper frame of baked rotation cannot be calculated for negative angles

I'm not sure whether it's my fault (I use Box2d to set my angles) but when a sprite with baked rotations gets negative angle then a proper frame of rotation cannot be calculated. It is so because FlxSprite._caf is a uint and therefore this line (421) in FlxSprite.updateAnimation():

_caf = (angle % 360)/_bakedRotation;

results in an integer overflow (or rather - underflow).

The problem can be fixed by replacing the above line with:

var tempAngle:Number = ( angle % 360 );
if ( tempAngle < 0 ) {
    tempAngle = 360.0 - Math.abs( tempAngle ); // or just 360.0 + tempAngle :-)
}
_caf = tempAngle / _bakedRotation;

FlxG.flash and FlxG.fade receiving the wrong color

For some reason, when calling one after the other, the color for the last one is applied to both.

IE:
FlxG.flash(0xffffffff,0.5);
FlxG.fade(0xff000000,1,function);
The screen flashes black, and then fades to black.

FlxG.fade(0xff000000,1,function);
FlxG.flash(0xffffffff,0.5);
The screen flashes white, and then fades to white.

[1.31] Collision not working in certain cases.

In my current game, I've been using the line
FlxG.collideArrays(_enemies,_blocks);
for collision, which in the latest version of collision code, doesn't seem to work. (The enemy sprites fall through the floor)

FlxG.collideArrays(_blocks,_enemies);
does work, but the previous code ran much faster as "dead" enemies won't iterate through every block since the code already skips over inactive objects, but with this line every block iterates through every enemy to see if it is active or not.

FlxText won't wrap text the first time

In order to get text wrapping correctly in an FlxText, I've had to do the following dance:

var string : String = "a really long string that will certainly wrap, I betcha";
var fltext : FlxText = new FlxText(0, 0, 50, string);
fltext.text = string;

Otherwise, it won't wrap.

On a hunch, I tried repeating the "_regen = true; calcFrame()" invocation at the end of FlxText's constructor, and that also fixes the problem (i.e., it lets me pass in the text just one time to the constructor). Using a null string and setting the text afterwards also fails; it seems like calcFrame() needs to get called twice to do its job.

[Flx 1.54] BUG - Tilemap-Sprites collision bug depending on parameter order

I found a problem in the collision code:

Let's say...
lyrMain is a layer that contains ONE tilemap.
lyrPlayer is a layer that contains ONE player sprite.

[CODE] FlxG.collideArrays(lyrMain.children(), lyrPlayer.children()); [/CODE]

Works as expected, the the player collides just the collidable tiles inside the tilemap.

[CODE] FlxG.collideArrays(lyrPlayer.children(), lyrMain.children()); [/CODE]

This fails, the tilemap is collided as if it were just a core (one big rectangle), not working as expected.

This is pretty ill-defined, and regardless of any documentation that could explain it... it's hard to find and fix. I suggest that both work the same way to make it more intuitive on the library user.

Regards

MouseEvent exist after switching states

Because of the new way mouse callback functions are handled (using the Flash eventlistener) in FlxButton mouse events exist even after the current FlxState has been destroyed. I've modified the code to remove the event listener by adding an empty destroy function in FlxCore which FlxButton overrides.

One-frame animations never finished

If you play an animation that has a frame-rate of zero, most commonly the case with one-frame animations, the FlxSprite's "finished" flag is never set to true.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.