Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - !8bit!man

Pages: [1] 2 3 ... 11
1
help / rotate boundbox?
« on: Wed, Sep 4, 2013 »
there's a way to rotate a sprite's boundbox?

thanks

2
help / Re: drawing lines from point to point?
« on: Mon, Sep 2, 2013 »
Seems interesting... anyway, how can i display the line made with that method? I've tried but nothing shows up  :/

3
help / drawing lines from point to point?
« on: Mon, Sep 2, 2013 »
hi guys, today i've tried to draw a line in my game (i need some lazors :D) but  the built in drawLine() function draws a line on the sprite i've selected...

there's some other way to achieve some good results? i also want to check if my player overlaps that line too..

thanks for your help

4
You're right about that! The results seem to be better. I might look into porting FlxDigger to Haxe / HaxeFlixel eventually actually. :)

Don't forget to say that Grey ported it to flixel then ;)

5
That demo isn't showing up for me, just as a big white square. Wondering if others have the same issue, anyway, here's the direct link to it.

The demo is a bit annoying because of the fading it uses everywhere, making you wait for a few seconds each time for no reason. Also kind of annoying that the map isn't regenerated instantly when pressing R. The jumping soundeffect hurts your eyes more than anything else.

Other than that, nice little demo. Seems like FlxDigger is extremely similar to FlxCaveGenerator. A demo for that one can be found here.

Well, we must say that a demo isn't made to let people have fun but to demonstrate what the code generates.
Also, nothing happens instantly: when you press R the demo redo all the procedure used to make a random map.


And i have to say that FlxDigger and FlxCaveGen. may have the same result (not every time you run them though), but they use different procedures: FlxCaveGen. infact firstly generates a 'noisy' matrix that must be processed afterward to obtain a playable level (that's why it uses what we call Cellular Automata). FlxDigger, instead, digs out on a full matrix a lot of tunnels.

The difference between the two methods, then, is that with FlxCaveGenerator you obtain large and almost empty rooms that aren't always connected each other while FlxDigger generates a map that is more suitable for platform games, as there are a lot of platforms and every single corner of the map is easy to explore.

6
well, goodmorning bros!!


after an extreme inactivity, i'm back and i also brought a demo project for you!


take a look:

<a href="http://greyproductions.altervista.org/DiggerDemo.swf" target="_blank" rel="noopener noreferrer" class="bbc_link bbc_flash_disabled new_win">http://greyproductions.altervista.org/DiggerDemo.swf</a>          (arrow keys to move around)

also you can download the project here (only for flashdevelop)

NOTE: i modified some part of the code. Now diggers are easier to adapt to different tile size.

hope this will help you guys.

7
Could You add an example game/pictures?
Sounds nice though...

why not? it will take some time though.... this week i'm really busy

8
releases / Re: FlxDigger (it digs your map!)
« on: Sun, Feb 10, 2013 »
Do you mean you've got errors in the class i've posted or in your Playstate class?

9
help / Re: what to do after profiling?
« on: Sat, Dec 22, 2012 »
profiler says 9.516.192, i suppose bytes.....


10
help / Re: what to do after profiling?
« on: Thu, Dec 20, 2012 »
Reduce the size or quantity of your game's bitmapdatas.


So can a really big tilemap influence memory usage?

11
help / what to do after profiling?
« on: Thu, Dec 20, 2012 »
hi guys,

i've used flashdevelop built-in profiler and i found my game's bitmapdata occupy a lot of memory: what can i do to improve this situation?

thanks

12
help / edit how you see objects on screen?
« on: Tue, Dec 11, 2012 »
Hi guys, how can i "deform" displayed objects? I mean something like moving their pixels in a certain way or move them in another location

13
hi guys, i'm here to share with you a method i use to generate random levels in my game MadAubergine.

one day, while i was searching for a cool method for generating random levels, i've found this tut http://noelberry.ca/2011/04/procedural-generation-the-caves/ and i've decided to follow it.

this is the result:

FlxDigger.as
Code: [Select]
package 
{
import org.flixel.*
/**
* ...
* @author Grey
*/
public class FlxDigger extends FlxSprite
{

public var Diggers:FlxGroup;
public var mat:Array;
public var cols:int = 0;
public var rows:int = 0;
public var cntdig:int = 0;
public var stuck:Number = 0;
public var oldx:int = 0;
public var oldy:int = 0;
private var szX:int;
private var szY:int;

public function FlxDigger(matrix:Array,Digga:FlxGroup,MapWidth:int,MapHeight:int,X:int,Y:int,sizeX:int=16,sizeY:int=16)
{
super();
makeGraphic(sizeX, sizeY, 0xff000000);
Diggers = Digga;
mat = matrix;
cols = MapWidth/sizeX;
rows = MapWidth/sizeY;
x = X;
y = Y;
szX = sizeX;
szY = sizeY;
}

override public function update():void
{
super.update();
if (stuck == 0)
{
oldx = x;
oldy = y;
}
cntdig = Registry.totdiggers - Registry.ddig;
stuck += FlxG.elapsed;
if (x-(szX*2) <= 0)
    kill();
if (x+(szX*2)>= cols * szX - szX)
    kill();
if (y-(szY*2) <= 0)
    kill();
if (y+(szY*2)>= rows * szY-szY)
    kill();
if (mat[y/szY][x/szX]==1)
mat[y / szY][x / szX] = 0;
chooseDir();
var f:Number = Math.random();
if (f > 0.91)
{
var d:FlxDigger = new FlxDigger(mat, Diggers, 640, 640, x, y, szX, szY);
Diggers.add(d);
Registry.totdiggers++;
}
if (Registry.totdiggers >= 340)
    kill();
if (stuck >= 1)
{
if (oldx == x || oldy == y)
{
Registry.ddig++;
    kill();
}
else
    stuck = 0;
}
}
private function chooseDir():void
{
var f:Number = 0;
//check if there are non-empty blocks
if (mat[y/szY][(x - szX)/szX] == 0)
{
if (mat[y/szY][(x + szX)/szX] == 0)
{
if (mat[(y - szY)/szY][x/szX] == 0)
{
if (mat[(y + szY) / szY][x / szX] == 0)
{
if(cntdig>1)
kill();
}
else
    y += szY;
}
else
{
if (mat[(y + szY)/szY][x/szX] == 0)
    y -= szY;
else
{
f = Math.floor(Math.random()*2)
if (f == 0)
   y -= szY;
else
   y += szY;
}
}
}
else
{
if (mat[(y - szY)/szY][x/szX] == 0)
{
if (mat[(y + szY)/szY][x/szX] == 0)
    x += szX;
else
{
f = Math.floor(Math.random()*2);
if (f == 0)
   x += szX;
else
   y += szY;
}
}
else
{
if (mat[(y + szY)/szY][x/szX] == 0)
{
f = Math.floor(Math.random()*2);
if (f == 0)
   x += szX;
else
   y -= szY;
}
else
{
f = Math.floor(Math.random() * 3);
if (f == 0)
    x += szX;
if (f == 1)
    y -= szY;
if (f == 2)
    y += szY;
}
}
}
}
else
{
if (mat[y / szY][(x + szX) / szX]==0)
{
if (mat[(y - szY) / szY][x / szX] == 0)
{
if (mat[(y + szY) / szY][x / szX] == 0)
   x -= szX;
else
{
f = Math.floor(Math.random() * 2);
if (f == 0)
    x -= szX;
    else
    y += szY;
}
}
else
{
if (mat[(y + szY) / szY][x / szX] == 0)
{
f = Math.floor(Math.random() * 2);
if (f == 0)
    x += szX;
    else
    y -= szY;
}
else
{
f = Math.floor(Math.random() * 3);
if (f == 0)
    x -= szX;
if (f == 1)
    y -= szY;
if (f == 2)
    y += szY;
}
}
}
else
{
if (mat[(y - szY) / szY][x / szX] == 0)
{
if (mat[(y + szY) / szY][x / szX] == 0)
{
f = Math.floor(Math.random() * 2);
if (f == 0)
    x -= szX;
    else
    x += szX;
}
else
{
f = Math.floor(Math.random() * 3);
if (f == 0)
    x -= szX;
if (f == 1)
    x += szX;
if (f == 2)
    y += szY;
}
}
else
{
f = Math.floor(Math.random() * 4);
if (f == 0)
    x += szX;
if (f == 1)
    y -= szY;
if (f == 2)
    x -= szX;
if (f == 3)
    y += szY;
}
}
}
}
override public function kill():void
{
if(!alive) return;
    velocity.x = 0;
    velocity.y = 0;
    alive = false;
    exists = false;
cntdig--;
}
}

}


how can you use it? do something like this:


DigState.as
Code: [Select]
package 
{
import org.flixel.*;
/**
* ...
* @author Grey
*/
public class DigState extends FlxState
{
[Embed(source = "media/wt.png")]public var wT:Class;
[Embed(source = "media/cursor.png")] private var ImgCursor:Class;

public var diggroup:FlxGroup;
public var splscrn:FlxSprite;
public var matrix:Array;
public var month:Number = 0;
public var mindiggrs:int = 300;

override public function create():void
{
super.create();
diggroup = new FlxGroup();
Registry.mapray = new Array();
Registry.totdiggers = 1;
Registry.ddig = 0;
Registry.mapray = genInitMatrix(640/8, 640/8);
splscrn = new FlxSprite(0, 0, wT);
var d:FlxDigger = new FlxDigger(Registry.mapray, diggroup, 640, 640, 5 * 16, 7 * 16, 8, 8);
diggroup.add(d);
add(diggroup);
add(splscrn);
FlxG.mouse.show(ImgCursor);
}

override public function update():void
{
super.update();
if (Registry.totdiggers >= mindiggrs)
{
    FlxG.fade(0xff000000, 1, go);
}
if (Registry.totdiggers < mindiggrs-50 && diggroup.countLiving() == 0)
    FlxG.switchState(new DigState);
}
private function go():void
{
FlxG.switchState(new PlayState);
}

public function genInitMatrix( rows:uint, cols:uint ,negative:Boolean=false):Array
{
// Build array of 1s
var mat:Array = new Array();
for ( var y:uint = 0; y < rows; ++y )
{
mat.push( new Array );
for ( var x:uint = 0; x < cols; ++x )
{
if (!negative)
    mat[y].push(1);
else
    mat[y].push(0);
}
}

return mat;
}
}
}

14
help / Re: get the displayed text width
« on: Wed, Oct 10, 2012 »
thanks!!  :)

15
help / get the displayed text width
« on: Mon, Oct 8, 2012 »
how can i do that?

16
help / Re: Animation doesn't restart
« on: Tue, Sep 18, 2012 »
yes

17
help / one color glowing in the dark?
« on: Mon, Sep 10, 2012 »
well, i've made some graphics for making a "darkness" effect and i need that, when it's activated, a color will start to glow.....
i need something like filters for this? how can i do this?
thx

18
help / Re: jumping enemy?
« on: Wed, Sep 5, 2012 »
Mmm.... i was thinking about something like this..... anyway, why do you put lots of "this"?

19
help / jumping enemy?
« on: Wed, Sep 5, 2012 »
how can i make an enemy play a certain animation, then jump and then do it all again?
thx

20
help / Re: Animation doesn't restart
« on: Sun, Sep 2, 2012 »
No i use object.reset(x,y)

Pages: [1] 2 3 ... 11