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

2
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

3
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 :)


http://www.mediafire.com/?w8y3hjt73pyy28e
The project is zipped up, and only at ~700KB :)

--note--
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.

update
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!

whew

4
games / Cycle of Life (finished)
« on: Sat, Dec 17, 2011 »
http://megaswf.com/serve/1427364

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. 

enjoy!

5
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).

:)

6
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?

7
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

BITCAVE

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. 

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

8
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]
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,1,1,1,1,1,1,0,0,
0,0,1,0,0,0,0,1,0,0,
0,0,1,0,0,0,0,1,0,0,
0,0,1,0,0,0,0,1,0,0,
0,0,1,0,0,0,0,1,0,0,
0,0,1,1,1,1,1,1,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0

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]
2,2,2,2,2,2,2,2,2,2,
2,0,0,0,0,0,0,0,0,2,
2,0,1,1,1,1,1,1,0,2,
2,0,1,0,0,0,0,1,0,2,
2,0,1,0,0,0,0,1,0,2,
2,0,1,0,0,0,0,1,0,2,
2,0,1,0,0,0,0,1,0,2,
2,0,1,1,1,1,1,1,0,2,
2,0,0,0,0,0,0,0,0,2,
2,2,2,2,2,2,2,2,2,2

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 :)

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

http://swf.percevic.com/caves/caves.swf

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.

10
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.

11
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?

12
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.

CONTROLS:
WASD or Arrows for movement

I hope you guys like it,

game.percevic.com/terra/terra.swf - sorry, my host is 1% uptime! :(

13
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 = FlxG.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;
        FlxG.camera.follow(player, 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.

http://swf.percevic.com/zeldazones.swf

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

==EDIT==
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;

14
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 :)

code:
http://code.percevic.com/C64Loading.as

example:
http://code.percevic.com/C64.swf

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

15
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?

http://megaswf.com/serve/1120545

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

16
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:
http://pastie.org/1875221

and here's the swf:
http://www.swfcabin.com/open/1304781565


Any help is appreciated

17
help / [SOLVED] collisions and overlaps
« on: Tue, Nov 16, 2010 »
demo here:   x is melee, arrows move
http://megaswf.com/serve/73028/

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) {
enemy.collide(enemy);
}

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.


18
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);
attacks.add(attackToAdd);
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) {
//FlxG.flash.start();
//attacks.kill();
//melee.kill();
                //melee.destroy();
attacks.destroy();
}
}

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!

19
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. 

tried:
-relaunching flex builder
-restarting comp
-reimporting project

any clues?

20
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:

http://megaswf.com/view/35c8cad9f3dbd0e11eed56ebd892167e.html

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]
package
{
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;

//testing
public var shapes:FlxGroup;

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

override public function update():void
{
// handle controls for shooting
p.update();
}

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


}

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
{
shapes.add(shapeToAdd);
}

public function addDoor(doorToAdd:Shape):void
{
doors.add(doorToAdd);
}

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

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

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

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.quake.start();
//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]
package
{
import org.flixel.*;

public class LVL_1 extends Level
{
public function LVL_1(X:Number=10, Y:Number=10)
{
initMap(level_1, data_tiles);
changeBG(0xffeeeeee);
addPlayer(X,Y);
makeShape(20,80,10,10,0xffff0000);
super.create();
}

override public function update():void
{
// initialize
initControls();
initCamera();

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

shapes.collide(p);
p.collide(shapes);

super.update();

checkDoor(firstDoor);
}

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]