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

Pages: 1 2 [3] 4 5 ... 11
41
help / Re: decent tile map editor
« on: Thu, Jul 22, 2010 »
me too me too.
I second Flan, it does everything you need (although I only use it for csv personally)
I have also had good experiences with Mappy and Tiled, but the cross platform-ness of Flan is hard to beat, and the layers are super handy.

42
help / Re: Enemy AI - Jumping up to a platform
« on: Thu, Jul 22, 2010 »
Thats pretty much exactly how you would do it, although you probably want to check and make sure the spot they will land is legit (Meaning, you want
if (getTile((x/map.tileWidth) + or - 1, (y/map.tileHeight) - (jumpheight in tiles)) < map.collideIndex && something to figure out where the player is in there to make sure its appropriate to jump){do your jumping code;})
You also need to make sure to pass your map to the enemy when you spawn them, for obvious reasons.

43
I wouldnt import the whole playstate, if thats what your asking, but I pass things other class' all the time and thats fairly legit.
I think in the case of just wanting one value, public static var is your friend. I use that ALL THE TIME, mostly to access groups and make spawners and what have you, because I fairly regularly want to do things like make something add or recycle an explosion in the playstate when I call kill, and although I COULD do that in the playstate, it makes more sense to just do it from a sprite.

44
help / Re: Enemy Flips Facing on Collide
« on: Mon, Jul 19, 2010 »
you want {facing = right; super.hitLeft(object);}
not just the facing bit. Otherwise that should work.

45
help / Re: Killing individual enemies in a group
« on: Fri, Jul 16, 2010 »
assuming you only have one player, I see nothing wrong with including if(_player.collides(enemys)){if(_player.dashtimer <= 0){_player.hurt(something);}}

*EDIT*
you can also stick this in the player object (or something similar to it in the enemies)
Code: [Select]
override public function collide(Object:FlxObject = null):Boolean
{
if(Object is enemyclass)
{
if (player.dashtimer > 0)
{
object.hurt(10)
}
else
{
hurt(1)
}
}
return super.collide(Object);
}

46
help / Re: Rotate camera?
« on: Fri, Jul 16, 2010 »
There totally is a way of doing this, but the performance loss on it is kind of astounding.
First, just code the game to work with the player changing angle instead of the world. I can give you a few different examples of how to make that work if you would like, but it vary's pretty heavily with game type.
Next, make a new flxsprite with the dimensions flxg.width, flxg.height. Set scale.x = scale.y = whatever the diagonal dimension (the square root of X squared + Y squared, according to Pythagoras) is divided by your smallest screen dimension (probably Y.) You can adjust this number to something that looks better provided it is a larger number then the actual result (for example, 2 looks better then 1.3333333.) You also may want to set antialiasing = true on this sprite.
Next up, override post process with this. BE SURE NOT TO ADD YOUR OVERLAY SPRITE.
Code: [Select]
override public function postProcess():void
{
if (overlay.angle != -_player.angle)
{
overlay.angle = -_player.angle;
}
overlay.draw(screen);
screen.draw(overlay);
//super.postProcess();
}
What this does, is creates a sprite that is the same size as the screen buffer, upscales it so that its smallest dimension is the same size as the largest dimension of the screen buffer, rotates it so that its angle is the opposite of the players angle, and then draws it to the screen buffer. The reason this is a performance hit, is that you are now rendering everything using vectors, and this pretty much nullifies all of the flixel optimizations to rendering.

47
help / Re: Multiple levels
« on: Fri, Jul 16, 2010 »
try using flxG.keys.justPressed("SPACE") instead of flxG.keys.space
There isnt anything glaringly wrong with the code you have posted, but FlxG.keys.space will make your flash and fade events trigger about a billion times at once, as the condition is basically "do this event as long as the space bar is held down"

48
help / Re: FlxEmitter / hurt animation
« on: Tue, Jul 13, 2010 »
blood = new FlxEmitter(X,Y);
blood.creatSprites((ImgBlood, 50 16, true);
playstate.flxgroupthatisastaticvariable.add(blood);

and that should do it.
For future reference, you can recycle the same emitter or sprites over and over again by using Flxgroup.getAvail()
Its handy, you can do stuff like
if (group.getAvail() == null)
{
thingy = new thingy(stuff);
thingy.dostufftomakeitathingy;
group.add(thingy);
}
else
{
thingy = group.getAvail();
thingy.dostufftoresetthethingy;
}

ofcourse, you need to make sure your group only has thingys for that to work, otherwise it will return some other thing in the group and try to assign it too a thingy, and either recycle it (like if thingy is a standard flxsprite, and the object getAvail() returns is also a flxsprite) or just freeze your program (if thingy is something other then what the other thing that getAvail() returned.)

Probably doesnt matter much in this game, but recycling objects is crucial if you want your game to have a bunch of stuff and run at a good fps.

49
help / Re: Multiple levels
« on: Tue, Jul 13, 2010 »
there are a plethora of ways.
The BEST is to have all the maps in the same playstate, and load them based on some value (flxG.level is what I usually use) then, when you hit the block, change that value to whatever the other level's value is, and restart the state.
You could also just make a different state for each level, and use FlxG.state = new your_next_level();

Your going to use FlxG.state to restart the current playstate as well, btw.

50
help / Re: Animated Coins?
« on: Tue, Jul 13, 2010 »
Im making a wild guess that the problem is in the coin function. Make sure you have
Code: [Select]
public function coin(X:number or int or uint or whatever, Y:see explanation for X, anything else you need your coin to know when its made like value or something):void
{
super(X, Y);
}
otherwise, when you call super, it will set the coins coordinates to the default coordinates (0,0) for a flxsprite when you call super, and everything will be added to the top left corner of the game world.

51
help / Re: FlxGroup as overlay
« on: Tue, Jul 6, 2010 »
I mean, you could just as easily set pause to true in your play state every time you want it to come up... I mostly just did it that way so I only had to use two lines to open a dialogue screen instead of three....

52
I just made a text engine that I could send an array to and have it advance through lines as a flxgroup, then made it my pause state.

53
help / Re: Flixel, Mappy, and Collisions.
« on: Tue, Jul 6, 2010 »
the problem is you have lyrStage2.add(_tilemap2); and never put in lyrStage2 = new flxGroup(); thus, it is a null object reference (on line 55, when you tried to add a tilemap to a group that doesnt exist and is thus null)

That being said, I think hunterxko confused you a bit.
You just need to make two tilemaps, one that is colliding, one that isnt, and dont call collide on the tilemap that is not colliding, fairly straight forward. You can even make the noncolliding one all background stuff, and the colliding one all walls and floor, there is no reason for them to have any overlap whatsoever.

If you CAN make the whole thing in one tilemap, then you can also just stick all your non colliding tiles at the start of the map, and set collideIndex to the number for the first colliding tile (tile zero is the first graphic in the strip, it should be blank as it wont be drawn,) and use one tilemap, and it will only collide with tiles that are after the collideIndex (so if tile 0 - 30 are not colliding, collideIndex = 31, and all tiles after 30 will get triggered by the collision)
...
Its really easier then these explanations make it sound, honest.

54
help / Re: Animated Coins?
« on: Tue, Jul 6, 2010 »
your trying to tell the state to play the animation, you want to tell the sprite too. You are either going to want to make a coin class that extends flxsprite, or at the very least assign a variable to the coin and use coin.addAnimation("spin or whatever" , [0,1,2,3,infinity] , framerate); coin.play("spin") after you set it up. I would honestly recommend just making a coin class so you dont have to do that every time you add a coin.

55
help / Re: FlxGroup as overlay
« on: Mon, Jul 5, 2010 »
In answer to your first question, you can totally have multiple pause states, you just have to set it up in whatever class extends flxgame.
In my current project, I have something that looks like this
Code: [Select]
override protected function update(event:Event):void
{
while (lastpause != FlxG.levels[14])
{
if (FlxG.levels[14] == 0)
{
pause = new inventory();
lastpause = FlxG.levels[14];
}
if (FlxG.levels[14] == 1)
{
pause = new dialogue(_dialogue);
lastpause = FlxG.levels[14];
if (FlxG.pause == false)
{
FlxG.pause = true;
}
}
}
super.update(event);
}

If I wanted to be smart about it, I could also recycle the same groups over and over again instead of making a new one every time it switched.
Note that I am using flxg.levels[14] to set what pause state I want to use, you can do this using any static variable that is accessible from your flxgame class, but levels and scores are already accessible, so I just made use of them (I used scores for everything that the player actually messes with, and levels to store all the temp data I need to be fairly consistent)

In answer to your second question, yes, you can, but its fairly tricky.
Basically, you need to make some sort of save feature that saves all the data, then loads it at the start of the state. This isnt tooo bad, but if you have a tun of data can be a pain in the neck.
You could also have everything in the level get added to a group in your main, but if you didnt empty it out, or had a bunch of data, this would quickly ruin your frame rate and memory usage, as flash would have to keep track of everything that was not in existence but being stored along with everything that was,so I dont really recommend it.

56
help / Re: Dashing
« on: Mon, Jul 5, 2010 »
Or, you could just avoid that hassle and use drag.x, seeing as its what it was made for.

57
chat / flex builder for freeee
« on: Mon, Jul 5, 2010 »
http://www.adobe.com/devnet/flex/free/index.html?sdid=GXVTO

So yeah, Flex Builder is free if you meet a few criteria.
You must either be unemployed, a student, or an educator.
I fall into the latter category, so I get it for free, along with as many licenses as I need (want), just as soon as I get around to scanning my ID, but I would put money on many people on this board falling into at least one of those categorys.

58
sooo... that works, and actually works pretty well, but you realize he can jump infinitely high right?
If thats on purpose, more power to you, could be a neat play mechanic (and I really like how easy to control the jumping is, if that's what you are going for...)

59
help / Re: What's under the mouse cursor?
« on: Mon, Jun 21, 2010 »
Its probably slightttly more expensive then doing it super OOP and having your mouse checks in the sprites themselves, but it should be infinitely easier to keep organized.

60
help / Re: Rotation and Inheritance
« on: Mon, Jun 21, 2010 »
Welll... I dont have a real answer to your question (I think it has to do with the way tilemaps are rendered, and them being arrays, and that making anything but 90 degree rotations not really feasible at all) BUT you could always rotate the screen buffer and use post process to draw it onto a sprite infront of everything... ofcourse, that would rotate EVERYTHING (If you dont want the player to rotate along with it, you could just rotate that sprite in the opposite direction, but it gets tricky if you say, want the level and not the enemy's to rotate)
You could also pretty easily adjust the players movement so that he then falls in the right direction and the controls re-orientate them self to the new angle. Its totally more work then rotating the map would be tho, so maybe someone else has a better idea?

Pages: 1 2 [3] 4 5 ... 11