entity instances

1 view
Skip to first unread message

gri...@griller.org

unread,
Sep 5, 2011, 5:36:17 AM9/5/11
to jsGameSoup
hi,

I have a entity with update and draw methods ... works like it should.

Now I add more instances of this entity via the "addEntity" to the
World. Nothing special this are only "Textentities" without an
image .... simply displaying text .

A mouseclick at one of this textobjects should change the text of
the "selected" entity only.

But here comes my problem.....all other instances change their own
text too.

Is this like it should work ?

Do I have to create an UID at Entity-Initialisation and compare this
ID later whith the Engine Entity Array to get the selected Entity
only ?

regards,
maik

gri...@griller.org

unread,
Sep 5, 2011, 7:48:45 AM9/5/11
to jsGameSoup
Hi,

Problem solved !

This was my bad because I did set the "text" property of the entity
directy via this.text = "some text". So the text for all the entities
got overwritten.

After I changed the Text property as a private var and wrote a
setText() function that handles the text ... e voila it works.

regards,
maik
Reply all
Reply to author
Forward
0 new messages