I’ve searched the forum now for some time but i didnt find a solution or hint that pushed me more into a direction so i ask you again for help wise beings.
this time i want to create a new entity (or instance?) of an entity class when colliding with the hero. actually if collided the hero becomes the new (duplicated) entity and gets recycled. i created some set/get functions to get the timing right and to know which class the collided entity belongs to but i dont know how to generate entities based of this class. i tried with the create function in my world class but what i got were those two errors:
with just (create(Leutnan,true));
in world update the game starts but this error occurs when my hero gets recycled:
[Fault] exception, information=ArgumentError: Error #1063: Argument count mismatch on Leutnan(). Expected 2, got 0.
i guess this is because my leutnan constructor expects two numbers (x,y). when i go with this (create(Leutnan(mori.transPoint.x, mori.transPoint.y), true));
(or simple numbers) it throws out this:
col: 56 Error: Incorrect number of arguments. Expected no more than 1. (create(Leutnan(mori.transPoint.x, mori.transPoint.y), true));`
col: 13 Error: Implicit coercion of a value of type Leutnan to an unrelated type Class (create(Leutnan(mori.transPoint.x, mori.transPoint.y), true));
Additionally i wonder if i have to precreate an array of variables or names for the “duplicated” entities or can FP do this for me? After added to the world i need to add some behavior to the entity as well.
Or is this too much to ask?
Can you give me a hint in which direction i need to dig?