Author Topic: flixel-android 0.3  (Read 7900 times)

Wing Eraser

  • Guest
flixel-android 0.3
« on: Sat, Mar 10, 2012 »
DOWNLOAD

http://www.wingeraser.com/flixelandroid/flixel-android.apk


Source: https://code.google.com/p/flixel-android/
Zip download available. (No new document available)



Hi guys,

A new version of flixel-android has been released. A copy paste of the SVN comments:
Update
libgdx-nightly-20120227

FlxG
- Added resWidth, resHeight, the width and height in pixels of the display surface.
- Added difWidh, difHeight, the differents between the ingame and display surface.
- Fixed the touch on different resolution.

FlxGame
- The new variables of FlxG will initialized at create().

FlxObject
- OVERLAP_BIAS change from int to float.
- Fixed the callback in seperateX and seperateY. It called onSeparateX/Y, it should be overlapsWithCallback.

FlxTileblock
- Complete.

FlxTilemap
- Rendering works.
- Auto rendering works.
- Not all functions are implemented.
- A part of the functions are not tested.

ArrayExtended
- Changed class name to FlxArray.

Added
- AFlxTile, used for callback
- FlxTile, complete.
- FlxTilemapBuffer, complete.

- TileDemo, shows FlxTileblock.
- TiledDemo, EZPlatformer.
- TiledDemo2, FlxCollision example 1.

Bugs
- Collision against FlxTilemap from left to right and top to bottom. The collision coordinates are wrong. It only happens when the FlxSprite doesnít have the width/height of power of 2 ( 2, 4, 8, 16, 24, etc).



Now the story to you guys. FlxTileblock is working great. I havenít any issue with it. It doesnít work like the original flixel, like using stamp(). Normally flixel copies pixels and merge them together to form a FlxTileblock. FlixelA is almost the same. It needs a Pixmap to merge sprites together, but this happens in FlxTileblock self and not in FlxSprite.

About FlxTilemap, this one is a pain in the butt. It took some days to get it working. It supports TMX. So you can use Tiled Editor or other editor that can generate TMX file. Iíve created the FlxCollision demo 1. Thanks to Lithander for having a TMX ready, it saved me some time.

There are several ways to generate a map.

Code: [Select]
_level = new FlxTilemap();
// The flixel way. An array of int.
_level.loadMap(FlxTilemap.arrayToCSV(data, 40), Asset.ImgTiles);
// Libgdx gives you a 2d array for the map. So I created a method that reads out a 2d array.
_level.loadMap(FlxTilemap.array2DToCSV(Asset.map.layers.get(0).tiles), Asset.ImgTiles);
// Or you can simply give the whole map as argument. The second argument is the layer number of the map.
_level.loadMap(FlxTilemap.tilemapToCSV(Asset.map, 0), Asset.ImgTiles);
add(_level);
Check out the TiledMap2Demo.


There is one annoying bug in FlxTilemap and FlxObject. The collision against FlxTile. Everything is find when a collision happens between FlxObjects/FlxSprites. When it happens against a FlxTile, it gives the wrong coordinates back of FlxTile. Iíve traced the variables when the collision happens and this is the result:

Code of responsible: FlxObject.separateX/Y. The code below is from separateY
Object1 is FlxTile
Object2 is Player/FlxSprite
Code: [Select]
if((-overlap > maxOverlap) || (Object1.allowCollisions & UP) == 0 || (Object2.allowCollisions & DOWN) == 0)
overlap = 0;
else
{
Object1.touching |= UP;
Object2.touching |= DOWN;
}


Java | AS3.0
Code: [Select]
Object2.x 312.4 vs 306.014
Object1.x 312.0 vs 312
Object1.y 64 vs 64
Overlap -6.969 vs -0.644
maxOverlap 4.174 vs 4.0409

So it happens to be the coordinates of the FlxTile. I donít know what the issue is. Everything goes fine when the collision goes from right to left and bottom to top and if the sprite has a width and height of power of 2.

So Iím asking the experienced users for help fixing this problem. If we can solve this problem then we are a step closer for good working framework.
The TiledMapDemo and TiledMap2Demo donít have touch screen controls. So youíll have to test it on the desktop.
If you got any problem with running the examples, drop a message below.

Thank you for your attention.
« Last Edit: Tue, Mar 20, 2012 by Wing Eraser »

test84

  • Key Contributor
  • *****
  • Posts: 1328
  • Karma: +0/-0
  • ت
    • View Profile
    • My personal site.
Re: flixel-android 0.3 beta
« Reply #1 on: Sat, Mar 10, 2012 »
Good job, would test it for you if I had an Android device around.
blog, twitter, Check out my award winning game, Rot Gut:

Wing Eraser

  • Guest
Re: flixel-android 0.3 beta
« Reply #2 on: Sat, Mar 10, 2012 »
You don't (and not recommend) have to test it on a android device/emulator. Just test it on the desktop. FlixelA also runs on the desktop if you didn't know that.

initials

  • Contributor
  • ****
  • Posts: 378
  • Karma: +0/-0
  • Initials
    • View Profile
    • Initials Blog. Code and other things.
Re: flixel-android 0.3 beta
« Reply #3 on: Sat, Mar 10, 2012 »
This is really cool. I've been asked a few times about a port of my Lemonade Factory game for Android, but I wouldn't know where to start if it wasn't for this.
Initials: Super Lemonade Factory, Super Lemonade Factory Part Two, Above The Clouds, Revvolvver, Four Chambers of the Human Heart

Seagaia

  • happens to be a
  • Active Member
  • ***
  • Posts: 112
  • Karma: +0/-0
  • Howdy
    • View Profile
    • twitter
Re: flixel-android 0.3 beta
« Reply #4 on: Sun, Mar 11, 2012 »
So I've never really done porting stuff. Is this more or less taking the AS3 Flixel code, and translating the functionality into Android-runnable Java code? How close is it to workable?

 I recently got one of the new-fangled Android devices, and I'd like to work on this but you seem to have it under control at the moment (and immediately I'd be of no help, looking at this one problem). Maybe port Power Tools or something in the future...
making anodyne, a zelda-like (with flixel!)
anodynegame.com

zanardi

  • Member
  • **
  • Posts: 59
  • Karma: +0/-0
    • View Profile
Re: flixel-android 0.3 beta
« Reply #5 on: Tue, Mar 13, 2012 »
Whats always wonders me is how the flxTileMap algorithm works. Who created it? And based on what algorithm he wrote that?

Wing Eraser

  • Guest
Re: flixel-android 0.3 beta
« Reply #6 on: Sun, Mar 18, 2012 »
Another beta released.

Change log for the lazy bums:


This revision includes fixes, patches and new features from Thomas W.

FlxBasic
- ignoreDrawDebug, should be false.

FlxCamera
- OrthographicCamera instead of Camera.

FlxG
- visualDebug = false at FlxG::init()
- deleted enableMultiTouch and enableMultiTouch.
- pauseSounds.
- resumeSounds. The original flixel bug included.

FlxGame
- implements ApplicationListener and InputProcessor.
- doesnít extend Game anymore.
- Added F1 and Menu (Android) key for toggling pause.
- Added F2 key for toggling visualDebug. There is no button assign for the Android.
- Use keyboard and touch simultaneous.

FlxGroup
- Fix bugs.
- setAll.
- callAll.

FlxSprite
- _color to long.
- alpha check.
- fix bug: animation looping problem by camasthecat.
- fix bug: AnimName wrong equal sign. Should be equals(Ö).

FlxText
- added shadow support.
- added size support. Itís not size in pixels, but percentage.
- added to use different fonts. I you do change size, be sure the font is loaded separated. Every FlxTexts that use the same bitmapfont data will be affected.

FlxButton
- added multi-touch support.

FlxTilemap
- Uses Array instead of FlxArray.
- Added the rest of unimplemented methods.
- fix bug: collision against FlxTile. Forgot to cast to float at FlxTilemap::overlapsWithCallback.

FlxU
- fix bug: floor Value cast to int.
- fix bug: Value cast to int.
- fix bug: formatTime, argument Seconds must be the type of float instead int. Cast to int for timeStringHelper.
- fix bug: getClassName.
- fix bug: getClass, fixed the return.

FlxPause
- uses FlxGroup. Extend it to customize it.

FlxSound
- Merged FlxMusic and FlxSound together.
- bug fix, music always get an ID of -1, which makes active always false.
- when paused, the sound will be stopped instead of letting it continue. There is no solution to pause sounds.

FlxMusic
- deleted. Got merged into FlxSound.

FlxTouch
- deleted. Called Mouse.

FlxArray
- deleted.

Library Trove
- deleted.

AFlxObject
- OverlapsWith renamed to onOverlapsWith.


Demos
- Bitmapfont demo

Broken
- Touch on different resolution. The demos that use touch input are broken.


Note
- visualDebug uses TextureRegion to render. Itís not recommended to use visualDebug on the phone. The rendering will be doubled and the performance will decreased dramatically. Use it on the desktop by hitting F2.



Thomas sent me a lot of fixes and new features. Be sure to thank him!




Wing Eraser

  • Guest
Re: flixel-android 0.3
« Reply #7 on: Tue, Mar 20, 2012 »
Out of beta. Zip is downloadable.

SVN comment:
Quote
Added .so files to make the android version runnable.
Fix the wrong url in the Tile demo.
Updated the license.

All demos are working.

The folder structure got changed
- flixel: main source
- flixel-examples: source of the examples.
- flixel-examples-android: android project to run the examples on the phone.
- flixel-examples-desktop: java project to run on the examples on the desktop.

initials

  • Contributor
  • ****
  • Posts: 378
  • Karma: +0/-0
  • Initials
    • View Profile
    • Initials Blog. Code and other things.
Re: flixel-android 0.3
« Reply #8 on: Tue, Mar 20, 2012 »
I've been floating the idea of putting Super Lemonade Factory on Android.

I'm going to attempt to get the demos running and go from there.
Great work!
Initials: Super Lemonade Factory, Super Lemonade Factory Part Two, Above The Clouds, Revvolvver, Four Chambers of the Human Heart