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

Pages: 1 2 [3] 4 5
41
games / Re: Terra
« on: Thu, Jul 21, 2011 »
weird, I get no error.  I uploaded that scores.txt file just now, maybe that'll stop the error.  I get 60fps on my computer, although I think its very memory intensive and since I'm nowhere near AS3 expert I'd suspect that its very inefficient and could be optimized.  I'm actually going to put up the source code later today, if anyone is interested in learning from it, or learning the things you should not do :P

42
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! :(

43
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;

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

45
lol its okay. for all we know, i may be very wrong about all of this.  anyway,
Code: [Select]
public function follow(Target:FlxObject, Style:uint=STYLE_LOCKON):void
{
target = Target;
var helper:Number;
switch(Style)
{
case STYLE_PLATFORMER:
var w:Number = width/8;
var h:Number = height/3;
deadzone = new FlxRect((width-w)/2,(height-h)/2 - h*0.25,w,h);
break;
case STYLE_TOPDOWN:
helper = FlxU.max(width,height)/4;
deadzone = new FlxRect((width-helper)/2,(height-helper)/2,helper,helper);
break;
case STYLE_TOPDOWN_TIGHT:
helper = FlxU.max(width,height)/8;
deadzone = new FlxRect((width-helper)/2,(height-helper)/2,helper,helper);
break;
case STYLE_LOCKON:
default:
deadzone = null;
break;
}
}
you see how the deadzone in most cases uses width and height are divided by multiples of 2? 

i think that if someone just added Math.floor to those deadzone numbers, it could get rid of that jittering problem for good.

46
I'm not sure if it needs to follow those standards 100% but thats exactly what has been causing problems for me. If you check FlxCamera you can see the styles and see which one exacty uses 1/2s or 1/3s

47
Some of the follow settings need the resolution to be divisible by 3, it depends on which follow style you choose. Going from 490 to 400 is a big jump, so just play with size until it feels right. Basically, whichever axis is giving you jittery movement, just play with the size of that axis until it's all smooth.

48
Weird, cuz I had an issue with smooth movement. It had to do with the size of your game. The width and height should be evenly divisible by 2 so the camera rect can work correctly. My height was not so when I moved up/down the player was constantly shaking and blurry

49
what do you mean stuttering? like its shaking? or the movement is not constant?

50
well, its tough to make sense out of the code.  there's a lot of undocumented stuff happening.  i think i dont understand what you mean by updating the field?  once you add a Basecell or a Border, its there, it wont go away, so there really is no need to re-add in the update.

can you explain what you are trying to do when you say update the graphics?

51
Hmm, can you zip your code up and upload it somewhere and share it on here? I can take a look at it for you today.  It's hard to tell what's going on with just a couple snippets of code here and there.

52
the memory issue he's talking about is the fact that you're adding something to the state inside of the update function.  update is called many times per second, so youre adding those objects many times over and over again.

anything that you add to the state should be done in the create() function, because that's called only once (when the class is instantiated).  move all your add(...) things into the create function and you should be good.

53
games / Re: Pixelvania - Metroidvania in Flixel
« on: Sat, Jun 4, 2011 »
very awesome game, brings back memories of metroid :)

the minimap is... way too mini lol, enlarge it just a little bit? or make it a full-blown map a la zelda or castlevania.

the controls could use some tweaking, but only for switching weapons.  i found that sometimes i press space twice when i only wanted to press it once, so switching weapons became a pain.  maybe use 1-3 numbers?

the weapons themselves are really cool, but i would do away with the water-freezing bomb.  instead, let the player just shoot the water with the ice beam to freeze it.  or better yet, make the ice beam a chargeable shot that you can unleash into the water to freeze.

one final thing; the art direction is nice, but too much of it reminds me of cave story, and some other games i've played that i can't remember the names of.  when i read your blog, the concept image of pixelvania really caught my eye.  in my opinion, the concept style is much much much cooler than the style you have going now.  i would love to see the game resemble more of the concept, the purple to orange background fade, the more solid white blocks, etc...

overall, great job.  i really look forward to the finished product.

54
help / Re: Accessing stuff that are on screen
« on: Sat, Jun 4, 2011 »
Lets say you have a FlxGroup for those random targets, called gTargets

in update you could:
Code: [Select]
gTargets.members.forEach(onScreenCheck);

then make a function called onScreenCheck:
Code: [Select]
private function onScreenCheck(object:Object):void {
   if( object.onScreen() )
      shootBullet()
}

Not sure if this really answers your question, but iterating isn't going to be a big hassle, its just really one function.  Taking this even further, you could have a FlxGroup for gTargetsOnScreen, and inside the onScreenCheck function you could:
Code: [Select]
if( object.onScreen() )
   //add it to gTargetsOnScreen
else
   //remove from gTargetsOnScreen

that way you'd have onScreen targets in gTargetsOnScreen to shoot at.  I hope this helps, its just the way I'd do it, but it may not even be an efficient way.  So good luck man

55
help / Re: hello world probelm
« on: Thu, Jun 2, 2011 »
hey dont give up yet!  i had the same problem and i found out what was causing it.

strangely, the default camera (before you set camera.follow) is not located at 0,0 in the world.  instead the camera is at 0,360.  this is with the latest build (2.5).  so the text you placed is offscreen, and you can fix this by adding:
Code: [Select]
FlxG.camera.follow(yourText);
i hope this helps, and dont give up on actionscript!

56
help / Re: Reloading bullets in shoot em up
« on: Sat, May 28, 2011 »
i would make the bullets in Hero a FlxGroup instead of Array and then from the playstate replace
Code: [Select]
heroBullets.add(bullet); with
Code: [Select]
hero.bullets.add(bullet);
not really sure if that'll fix your problem, but it might not be copying the members of your bullets into the array.  or you could also try:
Code: [Select]
for( var i:int=0; i<heroBullets.length; i++ ){
   hero.bullets.push( heroBullets.members[i] );
}

good luck

57
personally i prefer Adobe Flash Builder, i think there's a free student download of it too.

58
actually there's a better way.  the problem is that FD doesn't actually recompile the program, it just launches it.  the only time it really re-compiles it is if there is an actual change in your code.  so every time you change your tileset.png for example, just add a space somewhere in whatever class you have open, then save it and it will recompile it when you launch.

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

60
help / Re: Is this possible to do? (graphics question)
« on: Wed, May 25, 2011 »
lol sorry i didn't specify.  but any property you want to apply to an object usually goes inside the object's class.

Pages: 1 2 [3] 4 5