1.9.2013

Hi there, so... this is the new shit. I am restarting this blog.

I am getting in to this haxe programming thing and I must say that I don't know shit about it. So... fuck.

I have istalled haxe, openfl and haxepunk on my so reliable 13" ultabook. I had to have a fight wit vim do get it work (so far i've have no idea how to work with it effectively). It's Vim all the way. I like to keep things simple and with haxe I feel like that I have no other way. I don't know any working IDE's for it.

At this point I feel like I am bangin my head against this massive brick wall... though it all ways is at this point.

I've got only whew lines of code and it still doesn't work:

// Main.xh:
import com.haxepunk.Engine;
import com.haxepunk.HXP;
import scenes.*;

class Main extends Engine
{
    override public function init()
    {
        HXP.console.enable();
        //HXP.scene = new YourScene();
        HXP.scene = new MainScene();
    }
   
    public static function main() {
        new Main();
    }
}


// BaseEntity.hx
package entities;

import com.haxepunk.Entity;
import com.haxepunk.graphics.Image;
import com.haxepunk.utils.Key;
import com.haxepunk.utils.Input;

class BaseEntity extends Entity
{
    private var image:Image;

    public function new(x:Int, y:Int)
    {
        super(x, y);
        image = new Image("graphics/block.png");
    }

    override public function update()
    {
        if (Input.check(Key.LEFT))
        {  
            trace("LEFT");
            moveBy(-2, 0);
        }

        if (Input.check(Key.RIGHT))
        {
            trace("RIGHT");
            moveBy(2, 0);
        }
    }
}


// MainScene.hx
package scenes;

import com.haxepunk.Scene;
import com.haxepunk.debug.Console;
import entities.BaseEntity;

class MainScene extends Scene
{

    private var block:BaseEntity;

    public function new()
    {
        init();
        super();
    }

    public function init()
    {
        block = new BaseEntity(20, 20);
    }

    override public function begin()
    {
        add(block);
    }

    override public function update()
    {
        super.update();
    }
}


Yheah... that's it so far. I had to copy this this with gedit, because I have no idea how to copy anything with vim to my clipboard. I know that its sad (working on it).

I recommend everyone to try with ubuntu and terminal. This shit is tight. You have some work to do, but when you manage to do it it really feels good. 

Back to haxe and haxepunk. So far my code does nothing. It is supposed to print my aweseome block and move it horizontally... but NO! No idea why. Maybe haxepunk entities doesn't print graphics automatically event if I think that theys should.

I'll get back to you.  

// edit

Oh... don't know what happened.. but know it is displaying that awesome block.

ps. sorry abou typos, I will fix them later.. I am pretty tired right now.