Ash Newbie

84 views
Skip to first unread message

Marco

unread,
Oct 25, 2013, 5:23:57 PM10/25/13
to ash-fr...@googlegroups.com
Hi,
I'm new to Ash (and programming in general :P) and have some problems with a simple ash project.
A few days ago i finished my first programming "project", a pong clone written in Haxe using object-oriented programming.
After i read a blog post about Ash i got interested in it and i tried write another pong clone this time using ash.
My current problem is that i get many errors when i try to build my project like these:

src/systems/CollisionSystem.hx:69: characters 12-30 : Constraint check failure for getNodeList.TNode
src/systems/CollisionSystem.hx:69: characters 12-30 : nodes.PaddleCollisionNode should be ash.core.Node<nodes.PaddleCollisionNode>

It would be nice if somebody could take a quick look in the code and tell me what i did wrong :)





Dan Korostelev

unread,
Oct 25, 2013, 5:44:20 PM10/25/13
to ash-fr...@googlegroups.com
Currently, nodes in haxe version should extend base class ash.core.Node<YourNodeType>. For example:

class PaddleCollisionNode extends ash.core.Node<PaddleCollisionNode>
{
}

I probably should change it to some macro-based sugar, but I don't have much time to work on Ash-Haxe nowadays.

суббота, 26 октября 2013 г., 1:23:57 UTC+4 пользователь Marco написал:

Eric Lund

unread,
Oct 25, 2013, 5:53:42 PM10/25/13
to ash-fr...@googlegroups.com
Dan beat me to it. Yeah, the node thing is a little weird but it works. Also, subclassing a Node might not work, you may have to paste the position, motion, and collision components directly in to those classes instead. 

By the way, I still actively use this port, so thanks Dan. Haxe macros remain an enigma to me.

Dan Korostelev

unread,
Oct 25, 2013, 6:41:24 PM10/25/13
to ash-fr...@googlegroups.com
Well looking at it now, as a somewhat experienced Haxe'r, I could say there's much space for optimization in Haxe version, but it will break "almost line-to-line" compatibility with AS3 version. I'll probably rework iterators when Haxe 3.1/3.2 come out so they won't be created as objects but as mere inline variables.

As for macros - they are nothing really enigmatic in Haxe. Just a compile-time haxe code that generates code expressions from other expressions (well it generates whole new fields in the case of NodeMacro, but the principle is the same). I simplified the NodeMacro class in git version, using haxe 3 macro reification feature which is easy as string formatting :)

суббота, 26 октября 2013 г., 1:53:42 UTC+4 пользователь Eric Lund написал:

Marco

unread,
Oct 27, 2013, 8:19:31 AM10/27/13
to ash-fr...@googlegroups.com
Thanks for the answers :)
After i fixed the nodes i still get some errors:

1) in RenderSystem:
super(RenderNode, updateNode, addNode, removeNode);

-> Function 'new' requires arguments : nodeClass, nodeUpdateFunction, ?nodeAddedFunction, ?     nodeRemovedFunction
-> node : nodes.RenderNode -> time : Float -> Void should be nodes.RenderNode -> Void

2) in GameScene when i try to add a system:
-> characters 19-34 : systems.#CollisionSystem should be ash.core.System

even though CollisionSystem extends ash.core.System

Any hints ? :)

Marco

unread,
Oct 27, 2013, 8:55:06 AM10/27/13
to ash-fr...@googlegroups.com
ok 2) was easy to fix, i had to pass over a CollisionSystem object not just "CollisionSystem"

Marco

unread,
Oct 27, 2013, 9:07:38 AM10/27/13
to ash-fr...@googlegroups.com
also fixed 1) the functions i passed to ash.tools.ListIteratingSystem had to many arguments

It compiles now so theres only one little problem left, nothing is displayed.

Marco

unread,
Oct 29, 2013, 6:20:32 PM10/29/13
to ash-fr...@googlegroups.com
Can somebody tell me why the updateNode function of my rendersystem is not called? It's new method is called but its updateNode or addNode function is not even though it is extending ListIteratingSystem.

Alexander Kalinovych

unread,
Oct 29, 2013, 6:40:32 PM10/29/13
to ash-fr...@googlegroups.com
Hi,
I don't know what is the hell going on in your system with RenderableEntity... but I think update function should look like this:

public function updateNode(node:RenderNode, time:Float)
{
        node.Render.graphic.x = node.Position.position.x;
        node.Render.graphic.y = node.Position.position.y;
}


Середа, 30 жовтня 2013 р. 00:20:32 UTC+2 користувач Marco написав:
Reply all
Reply to author
Forward
0 new messages