Home | Rules and Guide | Sign In/Create Account | Write a Post | Reddit | #LD48 | #ludumdare on irc.afternet.org (Info)

Ludum Dare 30 — August 22nd-25th 2014 — Theme: ??? (Suggest a Theme)
  • Ludum Dare 30 Begins: in 28 days, 11 hours, 59 minutes, 50 seconds
  • [ Real World Gatherings | Ludum Deals (coming soon) | MiniLD #53 ]


    Lunch #1 and Serious Bug

    Posted by (twitter: @xMrPhil)
    April 21st, 2012 12:04 pm

    Lunch 1
    It’s almost 3 pm here in Arlington, VA and I’m having my first lunch for LD23. Kind of late but I wait until I’m hungry.

    Chicken and Vegetable stir-fry.
    Lunch 1

    Progress
    Screenshot 3
    It’s coming a long, but I’m feeling the pressure. My task list seems too long. Worst part is I’ve hit a bug! Maybe you can help? My FlashPunk Entity is not calling the Update method! I’ve triple checked and the World Update is being called and calling the supper.Update()!

    package SeedsOfDestruction
    {
    import com.greensock.easing.Cubic;
    import com.greensock.easing.Quad;
    import com.greensock.TweenMax;
    import flash.display.BitmapData;
    import net.flashpunk.Entity;
    import net.flashpunk.FP;
    import net.flashpunk.graphics.Image;

    public class SeedBullet extends Entity
    {
    [Embed(source = "/assets/Seed Bullet.png")] public static const SEED_BULLET:Class;

    public static const SPEED:Number = 200;

    public var image:Image;

    public function SeedBullet(player:Player)
    {
    // Make the Pink transparent
    var bitmapData:BitmapData = Global.MakeTransparent(SEED_BULLET);
    image = new Image(bitmapData);

    super(x, y, image);

    FP.angleXY(this, player.stem.angle, 40, player.x, player.y);
    image.angle = player.stem.angle;
    image.centerOrigin();
    image.smooth = true;
    active = false;
    layer = 2;

    setHitbox(40, 40);
    type = “seedbullet”;

    trace(“created”);
    }

    override public function update():void
    {
    trace(“update”);
    super.update();

    trace(“update2″);
    if (collide(“BadPlant”, x, y))
    {
    explode();
    }
    }

    override public function added():void
    {
    super.added();

    var time:Number = FP.distance(x, y, world.mouseX, world.mouseY) / SPEED;
    TweenMax.to(this, time, { x:world.mouseX, y:world.mouseY, ease:Quad.easeOut, onComplete:explode } );
    }

    public function explode():void
    {
    world.add(new Explode(this));
    world.remove(this);
    }
    }
    }

    Tags: , , , , ,

    One Response to “Lunch #1 and Serious Bug”

    1. MrPhil says:

      I FOUND it!!!

      active = false; // This tells it NOT to update.

      active property
      public var active:Boolean = false
      If the graphic should update.

    Leave a Reply

    You must be logged in to post a comment.


    All posts, images, and comments are owned by their creators.

    [cache: storing page]