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

Pages: [1]
1
help / What moves in Canabalt?
« on: Sun, Aug 5, 2012 »
Hi all, bit of a specific question here, really about how projects are structured.

I've been trying to build a small parody game based on the Canabalt concept. It was originally so throwaway I barely gave it a second though, but as time went on I got quite interested in the technical aspects of the game.

The iOS source, for instance, gives the player an X velocity as if the player is really moving, and uses this to calculate jumps and so on. But this is counter to how I thought the game would've been constructed (having the player not move at all, and moving the buildings instead). Otherwise it would necessitate constantly updating the boundaries of the FlxGame and the camera.

Does anyone have any suggestions on which way endless runner-style games should be calculated? Does the player move? Does the world move? Do both move?

I think there are arguments for all approaches, am interested to hear what everyone thinks.

2
help / Generate A Keypress Event
« on: Thu, Jul 5, 2012 »
Hey folk,

I spent every waking second of today getting to grips with putting a SWF file onto Android via AIR for Android. Man that was hellish. In the end though it works, and my little Flixel game appeared onscreen.

Tomorrow's job is to write code to receive keypresses!

Assuming I just do the ol' "semitransparent buttons on screen" schtick (which I hate, but it's good-enough for the scenario here) and can get the code to receive keypresses, the question then becomes how do I turn that event into Flixel thinking I pressed the right arrow key.

I know that receiving touch events requires fiddling - I'll worry about that tomorrow - my main concern is how to pretend to Flixel that someone has pressed the right arrow key, for instance.

EDIT - BONUS ROUND I heard someone mention that instead of fiddling with touch events I should just use mouseclicks, because apparently by default that's what a touch is interpreted as. Any truth to this, and is it a viable solution?

3
Hi all,

I'm building some simple Flixel platformers and in the past I've had complaints about the way the player handled in feedback from players. I've now compounded this problem by dropping the scale rate in Flixel from 4x to 2x, so all the values are off anyway. In short - I'm going back to the drawing board with my controls and I'd like some input from you guys on what values work, what ratios to bear in mind, and good ways of testing.

I'm using Flixel Power Tools, if that makes a difference. What approach do you folk use when tuning player movement speed, jump speed and so on?

4
Hey all,

I've just tried adding some backing music to a Flixel project for the first time (previously I'd only really put in some small sfx files.

Build time has exploded (this is running debug mode, on FlashDevelop).

I wasn't expecting this - the music file is only ten times the size of a sound effect file but the impact is far, far larger. Is there a way to reduce this impact? An alternative way of playing music? Anything I can do at all, really?

EDIT -

Solved myself

I decided not to remove the thread, although I just realised how to solve this problem myself.

Embedding files inside the SWF file seems to bloat the file and increase the compile time greatly.

The better way to do it seems to be:

Code: [Select]
var music:FlxSound = new FlxSound();
music.loadStream("../path/to/music.mp3", false);
music.play();

Because this keeps the music in the external file, but still accesses it when it needs it.

Thanks, me!

5
Hey folks,

I'm really getting into Power Tools and Flixel now. I'm working on a little city builder, nothing fancy. I have a large (screen-sized) invisible FlxSprite underneath my buildings in order to detect a click on an empty tile. When this happens, I pop up a FlxSprite with a FlxButtonPlus (from PowerTools) in it that acts as a close button.

This was working fine when the close button wasn't hovering over the invisible FlxSprite. In other words, if there was nothing clickable underneath the FlxButtonPlus, no probs.

However, now if I click on the close button, the click seems to bleed through the close button to the invisible FlxSprite underneath, which interprets it as a click on an empty tile. So it closes the first window, and opens a new one.

I tried using FlxG.mouse.reset() in the callbacks for both the invisible FlxSprite and the FlxButtonPlus, but this does nothing. I imagine the events are already pushed into queues by the time I've reset the mouse? I don't know.

Let me know what, if any, code snippets I should post for you folk. I just need to know if I'm making a mistake or, if not, how to only handle the 'uppermost' object that's being clicked on.

EDIT - Ahaha. Ahhh. I think I can see where this is going.

Code: [Select]
private function click_empty_tile(-params-):void {
trace(FlxG.mouse.justReleased());
show_some_popup();
}

The first time, this traces 'true'. The second time - that is, after I click the close button and it calls reset(), this prints false.

Is this the answer? Just conditionally check justPressed to see if something happened between the event and processing the event?

6
help / FlXGroup colliding with level
« on: Wed, Nov 9, 2011 »
Hey all,

I've looked around for something about this but I have a feeling it falls into the 'so basic no-one ever asked it' category. Basically, I am colliding a FlxGroup of snowballs (extending FlxSprite) with a FlxTilemap. It calls an explodeSnowball method which kills the snowball.

Unfortunately, this kills all snowballs onscreen, it seems.

Here's the code, maybe I'm missing something?

Code: [Select]
FlxG.collide(level, snowballs, explodeSnowball);
Code: [Select]
public function explodeSnowball(level:FlxObject, sprite:FlxObject):void
{
throwball = new FlxEmitter(sprite.x,sprite.y, 5);
add(throwball);
throwball.setRotation();
throwball.gravity = 60;
throwball.setXSpeed(-80, 80);
throwball.setYSpeed(-80, 80);
throwball.makeParticles(snowflake, 10, 0, false, 0);
throwball.start(true, 2, 0, 0);
sprite.kill();
}

Thanks!

7
help / Flixel Velocity & Calculating Jump Arcs
« on: Thu, Oct 13, 2011 »
Hello, Flixellers.

I'm currently writing some Java code that attempts to simulate my Flixel game under certain parameter settings. Essentially, I'm trying to calculate where the player can reach in the map, based on the current gravity and jump settings.

Has anyone had any experience of doing this? I'm not even looking for ActionScript code to implement it, just a discussion of the maths involved. I'm not sure what other forces Flixel considers besides velocity and acceleration, but I don't even know how Flixel implements these concepts (colliding with a platform at the side doesn't seem to slow down your vertical velocity, for instance).

Any help would be much appreciated!

8
help / Level Size Limits
« on: Sat, Oct 8, 2011 »
Now I'm all set up with Flixel (thanks for the help with cameras from before!) I'm looking at the main project, which is to build a 2D platformer with some built-in flexibility. The intention is to have a fairly large single-level game, in the style of VVVVVV, Knytt stories or perhaps Metroid-esque.

While I initially wanted it to be a single continuous level (all of the above examples use many linked screens) I'm concerned that Flixel might be overwhelmed if I try to give it a single level that's maybe a thousand tiles square. Assuming it's a desktop Flash app, what is a reasonable level limit? Has anyone hit performance problems with over-large levels?

9
I've just returned to Flixel having last looked at it ages ago, and I think it's causing some confusion. In my main as file I have this:

Code: [Select]
[SWF(width="640", height="480", backgroundColor="#000000")] //Set the size and color of the Flash file

Below it, this:

Code: [Select]
super(320, 240, PlayState, 2);
First question - what does 320x240 define? The width of the entire level in pixels, is what I'm thinking?

All of my sprites are 8x8 but I want them to appear much bigger on-screen. So I turn up the zoom to 4x, and then add these lines to the PlayState:

Code: [Select]
FlxG.camera.follow(player);
FlxG.camera.setBounds(0,0,level.width,level.height);

The second question is about the difference between what I think this does, and what it actually seems to do.

In my mind, the camera is now a 640x480 viewport, scrolling around a 1280x960 level, with boundaries around the edges.

However, what seems to happen is the camera is a 1280x960 viewport trying to display itself through a 640x480 window. What gives?

How do I get a screen-sized camera to follow a player around a level at a high zoom level? I feel I'm missing something obvious about either FlxCamera, the FlxGame constructor, or zoom levels. Help me!

Pages: [1]