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 - NateTheGreatt

Pages: [1] 2
I returneth to you, Flixel Help Forums, for another challenge I have been posed with: leveling and experience rates & calculations.

Does anyone have any tips/suggestions/examples they can give me that might make my venture into this scary world of maths a bit easier? Not only the math, but the structure of the calculations within my player class.

Really just any tips anyone could give would be greatly appreciated.

Also, if anyone has any experience with damage calculations taking stuff like armor and magic resistance into account, I'd love some input on that, too.

When I add two objects to an FlxGroup and I log members.length, it returns 2. If I add a third object, members.length logs to 4. Is this a bug?

I thought it was Flixel 2.50 so I tried updating to 2.55 and the bug persisted. Also, I noticed that when I logged FlxGroup.members it would log a list of objects to the console. After updating to 2.55, it logs nothing for FlxGroup.members.

Are these bugs?

help / More discreet collisions?
« on: Thu, Aug 18, 2011 »
I'm setting up an inventory system that works by literally fitting as many items as you can into the designated inventory zone. Right now for testing purposes I have created a bunch of sprites with random width and heights and added them into this zone. I call collide with that group of sprites on itself so they all collide with each other.

My problem is that sometimes the sprites get stuck inside of one another. How can I prevent this from happening?

How can I create a floating inventory GUI that maintains the X and Y positions of all objects inside of it locally? Meaning if I click and drag the inventory GUI, all of the sprites will go with it. I thought of using an FlxGroup but wasn't sure how to maintain the local coordinates of the contained objects :S

help / Entity ID system implementation
« on: Wed, Aug 10, 2011 »
I want to implement an entity ID system into my game because I am going to have quite a bit of of items and pickups. I wasn't sure of the best way to go about this. I would like to be able to call a function like player.giveItem(itemID) and have it sort out what type of item it is and put it in my player's inventory. For now the items are just weapons and ammo, but I plan to have a lot more items like tools, parts, accessories, food, etc.

Are there any standard ways to implement a system like this?

I've been at this for the past few days now. I'm making a top-down zombie shooter and I wanted realistic behaving bullets. I achieved this by iterating a small 1x1px sprite down a line when the mouse is clicked and checking for collisions on each loop-around. This worked beautifully for single-shot weapons and even automatic weapons. The problem I'm running into is shotgun-like behavior. What I did for that was send out this sprite to iterate down 6 different lines. The problem with this is that it lags before every shot, and lags to HELL if spammed. The cleanup is pristine, though, because the FPS goes back up when the shot is done iterating.

I tried something called tunneling, graciously suggested by someone on #flixel, which is basically splitting up the loop into different frames so it doesn't do it all in one frame while retaining most of the bullets instantaneous behavior. I had high hopes for this method, but alas: it still lags when the shotgun bullets go off, this time the lag is a bit more choppy instead of pushing one solid lag spike.

So: Can anyone suggest a way I could get some realistic shotgun shells off? Preferably with this technique but other techniques are perfectly welcome :]

I can have dozens (I've even tried hundreds) of zombies on-screen and they render and perform just fine. When I kill a few, however, the FPS drops drastically. I had 100+ on screen once and the FPS was ~50. I killed 3, fps dropped to ~10. I have no clue what could be causing this, as I've tried commenting out a lot of code that I thought could be the culprit (namely the random number generations and z-index sorting while the zombie is dead). It did help the FPS, but only by like 5 or 6 FPS. I've also commented out some of the shooting code, basically trimming the code to bear-bones point, click, and shoot and the zombie simply dying via kill(). It didn't help :/.

Here is my repo:

I don't have my flixel framework in the repo, I plan on putting it in soon.

Anyways, could anyone provide any insight on what's making the FPS drop so drastically? I'm using Flixel 2.5 if that's any help

help / Tile edge / border walls
« on: Fri, May 27, 2011 »
Hey Flixel,

I'm trying to set up walls in my game to be the edge / border of the respective tiles. I have a tile for each type of wall. Left, right, top, bottom, and corners.

I have collisions for the outside of the walls working with the setTileProperties() function allowing certain collisions. I'm kind of stumped on what to do for checking collision with the interior of the walls, when the player is overlapping the tile.

Is there a way I can get the tile's index that the player is overlapping?

I'm trying to use the FlxU.overlap() function to check collision between my melee sprite and a group containing my enemies.

My enemies are made of classes called EnemyEntity which extends FlxGroup and has a sprite inside for the graphic. I put all of these in another group called enemies in the playstate.

When I go to check for overlap via FlxU.overlap(melee, enemies, enemyHit), the game freezes up when it uses the callback function shown here:

Code: [Select]
public function enemyHit(_melee:FlxObject, enemy:EnemyEntity):void {}
I've identified the reason being that I'm using the EnemyEntity class (which extends FlxGroup) as a parameter, for if I change the parameter to enemy:FlxObject it works fine.

The problem is, I need the object passed in to be an EnemyEntity so I can access some public variables and functions necessary to have the enemy be hit and damaged.

Is it not possible to use custom classes as parameters in overlap() callback functions? If so, any suggestions on what I'm doing wrong?

help / Child class's public variable access problem
« on: Wed, Feb 16, 2011 »
I'm in a bit of a rut with this one. I'm really bad at explaining things so I'll just throw the code down and tell the problem, and hope someone's willing to help lol.
Code: [Select]
import org.flixel.*;

public class Entity extends FlxGroup

[Embed(source = 'data/images/items/coin.png')] private var imgSprite:Class;

public var sprite:FlxSprite;

public var maxHP:Number;
public var power:Number;
public var coinValue:int;

public var gravity:int = 800;
public var gravityOn:Boolean;

public var guiDisplay:int;
public var stickyGUI:Boolean;
private var gui:EntityGUI;

public function Entity(X:Number, Y:Number)
//property declarations
maxHP = 1;
health = maxHP;

//sprite = new FlxSprite(X, Y);

gui = new EntityGUI(this.x, this.y);

gui.hpBar.scale.x = maxHP;

guiDisplay = 0;

gravityOn = true;


/*public function loadSprite(imgSprite:Class, width:Number = 24, height:Number = 24):FlxSprite
sprite.loadGraphic(imgSprite, true, true, width, height);
return sprite;

override public function update():void

if (gravityOn) {
sprite.acceleration.y = gravity;

if (FlxG.keys.justPressed("E")) hit(.1);


if (stickyGUI) guiDisplay = 1;


private function displayGUI():void
if (guiDisplay > 0)
gui.visible = true;
if ( != sprite.x) = sprite.x;
if ( != sprite.y) = sprite.y - 10;
if (gui.hpBar.x != gui.hpBar.x = + 1;
if (gui.hpBar.y != gui.hpBar.y = + 1;
guiDisplay -= 1;
} else {
gui.visible = false;

public function recalculateHP():void
if (gui.hpBar.scale.x > .1) gui.hpBar.scale.x = health / maxHP * maxHP;
else kill();

public function hit(dmg:Number):void
guiDisplay = 100;
health -= dmg;

Code: [Select]
import org.flixel.*;
public class PlayerEntity extends Entity

public function PlayerEntity(X:Number, Y:Number)
super(X, Y);

sprite = new Player(X, Y);

stickyGUI = true;


override public function update():void



So I define the sprite as an FlxSprite. When I reassign it in the PlayerEntity child class, I reassign it as a Player class which extends FlxSprite.

The problem is that when I try to access the sprite's public variables inside of the PlayerEntity class (the Player class's public variables), it can not find them. I tried removing the sprite assignment in the Entity class and moving it to the PlayerEntity class like so:
public var sprite:Player;

and that enabled me to access the public variables. But the Entity class needs a sprite variable to do it's magic.

Any suggestions/ideas?

chat / Pokemon - Standing the Test of Time
« on: Thu, Nov 18, 2010 »
So I'm sitting here in my C++ class waiting for my professor to arrive, and the kid next to me turns to me and says "How would you rate Pokemon games at this day in age, against today's games?"

I thought about it, and I realized that I would probably still rate the game pretty high. Pokemon is still a very unique game, it's practically a sub-genre of its own.

Then I tried to abstract why. What makes Pokemon so unique? It has the basic elements of an RPG: open adventure, exploration, unique interactions throughout, and a strive for character improvement. Instead of strengthening the character you control specifically, you collect these unique entities with special and respectively categorized powers.

I was just wondering how you guys think Pokemon is seeming to stand the test of time? I'm trying to abstract it design-wise as much as I can.

I'm trying to implement mouse gestures into my game right now. I started off simple, just trying to enable the mouse to draw on the screen when the mouse is held down.

For some reason when I have this line in the create() function of the state:, 0x000000);

it breaks the state. Nothing appears and it seems frozen. Any ideas why this is happening?  ???

chat / RPG Stat System Framework
« on: Tue, Aug 17, 2010 »
I found a neat RPG stat system framework while looking into how to implement stats into my game. Thought I would share it here, in case anyone else was looking for something similar.

I think it's a very neat system. I'll be modifying this and using it in my games for sure.


help / Multi-layered Tilemap Collisions
« on: Thu, Aug 5, 2010 »
Can anyone suggest a way to give my character the ability to "jump up" a layer of tilemaps? Very similar to the mechanics of Mario; how you can run sideways through tiles that you can get on top of if you jump up.

games / [WIP] Casual Guy
« on: Sun, Jul 25, 2010 »
I'm working on my very first semi-large scale complete game project. It's a platformer. I plan on implementing some really nice melee combo moves and maybe some magic or ranged attack.

Here's the prototype engine so far:

Space to jump, again to double jump. X to attack (no animation for attacking yet). The blob thing has a simple AI in him. He will randomly wander about. If you get too close he will chase you, and stop if you get too far.

As you can see I'm still working on the graphics :P.

How do the controls feel? Any critiques / ideas / suggestions / input?

help / [SOLVED] Enemy AI - Jumping up to a platform
« on: Thu, Jul 22, 2010 »
I'm trying to implement some basic enemy AI into my small project. I already have a lot of aggressive AI set up into my enemies so that they chase after the player when the player enters a certain "aggro radius".

Now I'm trying to have my enemies jump up a tileblock if they are chasing the player and they run into one.

Any suggestions? I'm really stumped on this one.

help / [SOLVED] Player hitbox?
« on: Wed, Jul 21, 2010 »
What would be the best method to use when trying to implement hitboxes? For example on my player: Should I make my player class extend FlxGroup and add a player and  hitbox to the class?

I'm trying to make it as modular as possible

help / [SOLVED] Larger Tilemaps than SWF resolution?
« on: Fri, Jul 16, 2010 »
Right now I have a tilemap that is larger than the SWF resolution and my player is not colliding with the tiles outside of the resolution.

Is there any way to make large tilemaps or do I need huge SWF resolutions?

help / Pixel-perfect Tilemmap collisions
« on: Mon, Jul 12, 2010 »
I'm trying to implement a pixel perfect collision system between the player and tilemap of my game. I'm using the FlxHitTest class from the forums, but that only works with FlxSprites.

Any suggestions on how I could go about doing this?

help / Rocket launching movement
« on: Tue, Jul 6, 2010 »
I'm fairly new to AS3 and Flixel. I've only been practicing AS3 for a few months, and Flixel for a few short weeks. I've created a simple vertical scrolling space-shooter game.

I'm trying to animate a rocket shoot out from the side of the spaceship down at a short angle, and then launch forward. How could I go about doing this? I tried to figure it out and this is as far as I got (this code is in the update() function of my Rocket class):

Code: [Select]
if (!ignited)
velocity.y = 50;

if (leftOrRight) {
velocity.x = 50;
} else {
velocity.x = -50;

ignited = true;

if (ignited)
velocity.y = 500;
velocity.x = 0;

I'm still very unfamiliar with the movement controls of Flixel. Any suggestions?

Pages: [1] 2