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

Pages: [1]
1
help / Moving a Hero in a game
« on: Tue, Nov 17, 2015 »
Hello all,

I'm having a real tough time figuring this one out.

I have a Hero sprite and I need to do the following. (I can capture the right and left keys, just don't know the logic to get the sprite to move properly)

  • The sprite starts moving right at a constant speed.
  • If you press the left arrow key it should move left; right arrow key move right. When the key is pressed it should speed up, then slow down to the constant speed. The more you press a key, the faster it goes in that direction before slowing down again.
  • If the sprite is on the right side of the screen, and no keys are pressed, it will continue right at a constant speed. The same goes for the left.

I can get the sprite to move left and right but the speed up/slow down I can't get. I've read tutorials but nothing is working for me

Thanks!

2
help / Flixel Power Tools Demo Source or Documentation
« on: Sun, Feb 15, 2015 »
Hello,

I've been looking for the Flixel Power Tools demo source or documentation and can't find it anywhere. Can someone post a link?

Thanks!

3
help / Colliding with rectangle drawn in a sprite
« on: Fri, Jan 23, 2015 »
I have a class that extends FlxSprite and I can draw the rectangle in the class in the draw() function.

What I need to do is to have other sprites collide with it.
Code: [Select]
package 
{
import flash.geom.Rectangle;

import org.flixel.FlxG;
import org.flixel.FlxSprite;

/**
* ...
* @author ...
*/
public class gutter extends FlxSprite
{
private var nX:Number=0;
private var nY:Number=0;
private var nWidth:Number=0;
private var nHeight:Number=0;

public function gutter (X:Number=0, Y:Number=0, Width:Number=0, Height:Number=0){

nX=X;
nY=Y;
nWidth=Width;
nHeight = Height;
var mygutter:Rectangle = new Rectangle(nX, nY, nWidth, nHeight);
super();
}

override public function draw():void {
super.draw();
var mygutter:Rectangle = new Rectangle(nX, nY, nWidth, nHeight);
FlxG.camera.buffer.fillRect(mygutter, 0x66FF0080);

}

override public function update():void{

super.update();
}
}
}

When I do this, though, the collisions don't happen. Any ideas?

4
help / Adding Emitters to FlxGroup help
« on: Mon, Dec 29, 2014 »
Hello,

I'm adding Emitters to an FlxGroup and have some questions:

1) How do I make these emitters have a velocity like a FlxSprite? I want each to fall down the screen at a constant rate (particles would continually be emitted as they fall).
2) Once the emitter leaves the screen how can I reuse it at the top?

Thanks!

Pages: [1]