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.

Topics - bpercevic

Pages: [1]
releases / fliXNA
« on: Thu, Jan 5, 2012 »
now that fliXNA is nearing completion, I was hoping to get some feedback and/or feature requests.

pretty please  :P

chat / FliXNA - with Xbox and Windows Templates
« on: Sat, Dec 31, 2011 »
This is a port of version 2.55.  It is not yet finished but it has enough features for a full game.  Getting started is really easy with the Templates, all you need is Visual Studio 2008+.

Xbox Template and Windows Template

FliXNA github repository

help / [SOLVED] collision headache
« on: Wed, Dec 28, 2011 »
alright code gurus, I wasn't sure which channel to post this in since this is regarding an XNA port of flixel, but I need help with it regardless.  I'm not using x-flixel, but instead I ported flixel over myself.  Everything thats essential works (sound, camera, tilemapping, zooming, state machine, etc) EXCEPT collision between tilemap and sprite, but sprite on sprite works just fine.

here's an image to demonstrate the problem:

the player goes through tiles from top and left, but collides from bottom and right.  when walking up/down a wall from the right, sprite walks smooth.  but when walking RIGHT TO LEFT only from the bottom, the sprite gets stuck at the corner of every tile.

I tried to keep the code identical to the originals. FlxObject, FlxQuadtree, FlxTilemap, FlxTile, all look the same. But some things were altered like uints to ints, members of FlxGroup are Lists<> not arrays. 

My server is down at the moment and I don't use github :( so I will have to give a megaupload link to the code.  I'll include the whole project which you can open in Visual Studio.  It's a Windows/XBOX project so it may ask for an xbox to be connected, but thats not a problem you can just right click on the project titled "Xbox360 Copy..." and click "Create Copy for Windows" and you can run it just fine.

I know I'm asking a lot, but it would be really awesome to have this issue finally figured out so that I can start making games on xbox :)
The project is zipped up, and only at ~700KB :)

I was using x-flixel but its a port of an outdated version flixel (remember when you had FlxG.follow(target, lerp), FlxG.followBounds(), etc), and its collision is not working correctly either.  even though the collision works much better than mine, it still isn't acting right because sprites get stuck at every tile, its impossible to walk smoothly along a floor or a wall.

my port is of the newest version, minus the multiple cameras.  and the only problem I have is the tile collision.  if anybody would be interested in helping me figure out the issues that would be really great and I would definitely share the code with everyone to use because the older version of flixel is just not as fun as the newer.

if figured out the issue. in FlxTilemap's overlapWithCallback function the range of tiles to be checked for collisions needed to be incremented by 2 instead of 1 and it solved the collision issue!


games / Cycle of Life (finished)
« on: Sat, Dec 17, 2011 »

I'm not too proud of this title, but I want to post it anyway to see what you guys think.  This was for an independent study, I didn't have a lot of time so the sprites are crappy and lack any cool animations.  The theme of the project was life, so I created a continuous game that you can quit once you played through it one time but otherwise it keeps looping to simulate life/ generations of a family.

move with arrows, interact by pressing space or holding space if you're unsure of what to do. 


chat / moving from AS3 to C/C++
« on: Fri, Dec 9, 2011 »
Lets say I know AS3 and Flixel like the back of my hand, BUT I've never taken a stab at game development in a more prominent language such as C/C++.  Given that I've never done anything other than command-line C/C++, where would I start?

Existing frameworks?
Make an engine myself?
What should I study?

Hopefully someone who has been through this can share a few pointers (no pun intended).


help / zelda-style screens
« on: Sun, Oct 9, 2011 »
just curious how you guys would do zelda-style screens, like where the camera follows only a specific zone, then when you reach the edge it either snaps to the new zone or freezes the game to scroll.

i wrote a function that updates the camera boundaries based on the players location, so its not very flexible.  basically i define what the screen size is, like 30x20 tiles and then calculate to see if the player is within a 30x20 section and snap the camera to that section.  the problem is that when my game world gets huge i have to make sure all sections are about the same size.

anyone have a really nice way to implement screens?

games / BITCAVE (WIP)
« on: Thu, Jul 28, 2011 »
so this is my latest experiment, BITCAVE, using a random cave generation algorithm that i wrote myself... that i'm actually satisfied with :P.  the goal with this project is to make a fun and addictive exploration adventure.  i plan on having lots of collectible items, enemies to fight, people to meet, and quests to undertake.  i want the controls to be super simple, only one action button.  digging and exploring is the main mechanic at the moment.

- arrows move, x is action.
- hold x to dig, however there are indestructible walls.
- water slows you down, lava hurts you.

there is lots left to do:
- smarter enemy AI
- variety in enemies
- variety in collectibles
- npc friendlies
- quests & quest-management
- animate water & lava
- plus more that i can't think of at the moment


oh, and if you don't like the generated cave, press Enter to regenerate :)

I'd love to hear suggestions for gameplay and/or mechanics. 

7/30 - added fullscreen mode, press F (only available if you download the SWF)
7/31 - keep digging to uncover a surprise :P

help / string manipulation help
« on: Thu, Jul 28, 2011 »
I'm looking for a way to modify a string of data for a tilemap.  Lets say I have this:

Code: [Select]

because one ability of my player is to dig through walls, so the 1's can essentially be destroyed.  The problem is that the player can reach the end of the map and leave the game area.  So I want some procedure that iterates through the string and replaces all the 0 indices on the perimeter of the map with another index that is indestructible.  Basically I want this:

Code: [Select]

I'm going to try to figure this out on my own, but if anyone can beat me to a solution, that would be awesome :)

help / random cave generator
« on: Mon, Jul 25, 2011 »
i hacked together a little cave generator:

hit enter to regenerate, you might have to scroll the camera with the arrow keys in case the cave is off screen.

this algorithm, if you wanna call it that, isn't like the one floating around the forum.  i had no idea what i was doing, i just tried to use recursion, or what i remember of it from school lol.  if anyones interested in the code, i'll post it.  i figure its useful for creating random csv files for a cave to load with FlxTilemap.

iOS / flixel-iOS for native mac games?
« on: Sun, Jul 24, 2011 »
just curious, can the flixel-iOS library be used to make native mac games or is it iOS device exclusive?  I've never coded anything in obj-c but the recently released Mode source code looks pretty self explanatory. 

if it is possible to use f-iOS to make a Cocoa app, how would you set that up?  just import and use the source, or would you have to make some changes to the source?

it would open up a whole world of possibilities.

chat / how did you get where you are?
« on: Sun, Jul 24, 2011 »
what libraries/languages do you guys use?  what did you start with?  what do you like the most?  how did you get started with game dev, did you know a lot when you began or did you start newb and teach yourself?

I've been teaching myself for the past year or two. some languages still trump me, like c++, I have yet to successfully compile anything using a graphics library in c++.  a couple of days ago I tried XNA. the methods of development in XNA are pretty bizarre for me after such long exposure to flixel/as3.  i think that actionscript is by far the easiest language to make games in, especially with flixel. 

I started with c++ a few years ago and gave up because it was too difficult with little knowledge.  I picked up flixel last year in January and it didn't have very many great tutorials so I gave that up too.  between then and spring semester this year I took classes in java, prolog, c, etc.  so this spring I decided to try flixel again, and it was one of the most rewarding things I've ever done, everything suddenly made sense to me and I think it had a lot to do with those courses I took over the last year.

and now I'm trying XNA, which is tough because there are no simple classes for anything, I had to make my own sprite class, it has velocity/drag/acceleration and no collision..  and thats about it lol, it took me a while to adjust to the syntax, and now I see how hard it is to put together a library.  Props to Adam.

So I'm curious, how did you guys get to where you are?

games / Terra
« on: Thu, Jul 21, 2011 »
I was playing around with some blend modes and after throwing in some simple AI, I came up with Terra.

this is you:

you want to collect these, Stars:

and avoid these, Guardians:

here's a screenshot:

The objective is to score as high as possible.  The Stars run away from you, the Guardians chase you.  The Guardians will sacrifice themselves for the Stars, and if they do then you get minus points,  If you collect Stars you get plus points.

To collect a star you have to hover on it for 2 seconds, but the trick is that they run away so you have to be quick and stay on them.  The amount of points you get depends on your average velocity at the time you collect them.

Guardian sacrifices happen when the Guardian stays in contact with you for 2 seconds, for which the points are also calculated by average velocity, but watch out because they like to surround you if you aren't fast enough to get away.

After 90 seconds you'll see your score, at which time you can press enter to restart.

WASD or Arrows for movement

I hope you guys like it, - sorry, my host is 1% uptime! :(

help / (SOLVED) Zelda-style camera follow zones
« on: Wed, Jul 20, 2011 »
I'm trying to make zelda-style zones work, the kind where you reach the edge of the screen and the camera snaps to new boundaries.  I added this inside of FlxTilemap:

Code: [Select]
public function followModulus(player:FlxPlayer, ZoneWidth:Number, ZoneHeight:Number, Camera:FlxCamera=null):void {
if(Camera == null)
Camera =;
var minX:Number = ((player.x/ZoneWidth)*ZoneWidth) - (player.x%ZoneWidth);
var minY:Number = ((player.y/ZoneHeight)*ZoneHeight) - (player.y%ZoneHeight);
var maxX:Number = minX+ZoneWidth;
var maxY:Number = minY+ZoneHeight;, FlxCamera.STYLE_TOPDOWN);
Camera.setBounds(minX, minY, maxX, maxY, true);

The reason I use modulus here is because it lets me find the x at which the player is, in multiples of any number, like 1000 for example. so that I can use that number for the zone boundaries

ZoneWidth/Height are the boundaries of each zone.  So if I have a tilemap var map, I'd call map.followModulus(player, 1000, 1000) as an example.  The camera follow works as expected with one weird bug: the camera doesn't stay bound to the maxX and maxY of some of the zones.  Here's the swf, with each zone having a somewhat transparent color on it so you can distinguish each one.  If you walk straight down you'll see an example of the weird bug.

if anyone has any idea how to fix this, i'd appreciate it a lot :)

I solved it, just a dumb mistake, I didn't read the parameters to setBounds correctly.  The maxX and maxY should just be the zone width/height, not the coordinate of the border.

Code: [Select]
var maxX:Number = ZoneWidth;
var maxY:Number = ZoneHeight;

help / a classic C64 style loading state for you all
« on: Mon, Jul 18, 2011 »
I got bored and felt like making a c64 loading screen, with the crazy colored stripes.  hope you like it :)



I added a couple more things, a console with random letters.  links are updated.  enjoy :)

help / camera blurs the character (SOLVED)
« on: Wed, May 25, 2011 »
this is bugging me a lot, i'm not sure what's causing this but the player gets blurry once the camera starts to follow it.  as long as the player is within the follow bounds (so that the camera is standing still) it renders fine, but then once you move it blurs.  anyone know why?

Your game width and height need to be divisible by 2.

help / 2.5 TileMap collision issues :(
« on: Sat, May 7, 2011 »
Okay so 2.5 is great, but doesn't really work for me like the previous version  :-\

The problem is that collision with my tilemap only works for the initial tilemap that was rendered on the screen.  the rest is just walkable and i dont know why. there's a label with the player's Y, at about 600 the collision breaks, <600 is okay, >600 not working.

here's my code:

and here's the swf:

Any help is appreciated

help / [SOLVED] collisions and overlaps
« on: Tue, Nov 16, 2010 »
demo here:   x is melee, arrows move

im having difficulty with collisions and overlaps.  ive searched the forum inside and out but am unable to find a suitable solution.  

ive tried each these in my update but no luck
Code: [Select]
FlxU.solveXCollision(enemies, enemies);
FlxU.solveYCollision(enemies, enemies);

for each( enemy in enemies) {

i even added fixed=true and solid=true to my NPC and that didn't help.  for some reason enemies just go through each other no matter what.

enemies is just my group that holds all the enemies, each time an NPC is created i call enemies.add(npc)

a melee attack on individual enemies works, because i recursively call npc.hurt(1) and it executes that properly.  so that eliminated my first thought that i was possibly adding the enemies incorrectly.

help / melee methods for topdown games
« on: Sun, Oct 10, 2010 »
im searching for different ways one can implement melee attacks for a topdown shooter.  here is my method which isn't really working for me that well.  basically i create a shape in front of the player for a split second and check overlap between the npc and the shape, if overlaps then destroy the shape and health-- on the npc.  however it seems to not be killing the shape and although it disappears after a split second it continues to drain the health of the npc and it dies within seconds.

in my base Level class i have lots of functions for creating and managing objects in the game.  here is a function for the attack:
Code: [Select]
// attacks is a FlxGroup
public function createAttack(X:Number=0, Y:Number=0, W:Number=1, H:Number=1, C:uint=0xFF597137):Shape
var attackToAdd:Shape = new Shape(X,Y,W,H,C);
return attackToAdd;

here is the function in action:
Code: [Select]
// this is just one of the times its called,
// the location of the melee is determined by the players velocity
// i wont show all of them since they are all the same for each direction
if(FlxG.keys.justPressed("X")) {
if(p.velocity.x > 0) {
melee = createAttack(p.x+6, p.y, 10, 3);
meleeTimer = 1.1;

// here is where i think the problem is
meleeTimer -= FlxG.elapsed;
if(meleeTimer > 0) {
if(meleeTimer <= 1) {

i think that the shape created as the melee attack isn't getting destroyed, and it floats on top of the enemy and drains the health completely in an instant.  i tried melee.kill()/destroy() and killing the entire group.  i dont really understand the difference between kill() and destroy(), but either way neither of those are working in this case.

i would greatly appreciate any help, even if it is an entirely different method for melee attacks.  this is my first flixel project, well first game project all-together, so i apologize for any newbie mistakes. thanks!

help / building issues
« on: Sat, Oct 9, 2010 »
something seems to be wrong with flex builder, or my project.  i had a project i was working on over the summer that i havent touched until yesterday.  now, whenever i make a change to the code, save everything, and run the game it plays whatever my project was over the summer, none of my current changes ever go through.  i can't figure out at all what is wrong. 

-relaunching flex builder
-restarting comp
-reimporting project

any clues?

help / collision help
« on: Mon, Jun 7, 2010 »
hey everyone,
im having trouble dealing with collisions. ive searched the forum and didnt really find anything that helped me.  i made doors using collisions that transfer you to other states and that works fine, but when i draw objects to collide with (other than the map tiles) i run into some trouble. heres the link so you can see whats happening:

the green are doors, they work.  the brown and red squares are what arent working right.  the brown is a stationary object and its not supposed to move upon collision, but if you move into it a few times it budges by one pixel and the old position is not re-rendered so it looks like its getting bigger.  the red is supposed to be a movable object, it actually does move with the player but the player goes halfway through it before it moves and then eventually all the way through it.  i want the brown not to move at all, and the red to move but without the player sliding through it. code below.

This is for my level class, basically i made Level extend FlxState and it just has functions for drawing the map, adding objects, and initializing camera/controls.  
Code: [Select]
import org.flixel.*;

public class Level extends FlxState
// map definitions : list all map layouts and tiles to use
[Embed(source="data/tiles.txt", mimeType="application/octet-stream")] public var level_1:Class;
[Embed(source="data/tiles2.txt", mimeType="application/octet-stream")] public var level_2:Class;

[Embed(source="data/tiles.png")] public var data_tiles:Class;

// pre-definitions
public var map:FlxTilemap;
public var p:Player;
public var doors:FlxGroup;

public var shapes:FlxGroup;

public function Level():void
// handle main
doors = new FlxGroup();
shapes = new FlxGroup();

override public function update():void
// handle controls for shooting

public function initMap(level:Class, tiles:Class):void
map = new FlxTilemap();
map.loadMap(new level, tiles, 8, 8);
map.collideIndex = 4;


public function makeShape(X:Number=0, Y:Number=0, W:Number=1, H:Number=1, C:uint=0xFF597137):void
shapes.add(new Shape(X,Y,W,H,C));

public function addShape(shapeToAdd:Shape):void

public function addDoor(doorToAdd:Shape):void

public function addPlayer(X:Number, Y:Number):void
p = new Player(X,Y,0xff123cde);

public function changeBG(bg:uint):void
FlxState.bgColor = bg;

public function initCamera():void
FlxG.followBounds(0,0,map.width-8,map.height); // -8 cuz camera overlaps map by 8px

public function initControls():void
if(FlxG.keys.justPressed("F") && p.dead==false) { FlxG.flash.start(); }

public function checkDoor(doorNum:FlxObject):void
//FlxU.overlap(p, doorNum, resolve);

public function resolve(player:Player, door:Shape):void
//FlxG.state = new LVL_2();

A few functions are overridden in the LVL_1 class like checkDoor and resolve.  This code is just level 1
Code: [Select]
import org.flixel.*;

public class LVL_1 extends Level
public function LVL_1(X:Number=10, Y:Number=10)
initMap(level_1, data_tiles);

override public function update():void
// initialize

// add objects
var firstDoor:Shape = new Shape(50,80,10,10);
var thing:Shape = new Shape(30,60,10,10,0xff736357);




override public function resolve(player:Player, door:Shape):void
FlxG.state = new LVL_2();

override public function checkDoor(door:FlxObject):void
FlxU.overlap(p, door, resolve);

so im wondering if the "shapes.collide(p)" is not meant to be used like that. (although without that player just moves right through the objects)  so i have no idea what to do.  is my code wrong?

thanks in advance this has been killing me for the past few days i just cant wrap my head around what to do.

Pages: [1]