Wintermute Engine => Technical forum => Topic started by: Mihulik on July 22, 2010, 08:14:14 AM
Title: Sprite moving and entity position
Post by: Mihulik on July 22, 2010, 08:14:14 AM
Hi, I'd like to have an entity which is moving over a screen. So, I made a sprite by SpriteEditor, added an image, set looping on true and set "Move by" on -3/0. In SceneEditor I connected that sprite with an entity.
In a loop I check a position of that entity. However, the entity X property is always 0.
I need to check whether the entity X property has some value and if so, I wanna change something.
I'd be glad of any help. :)
Thanks!
Title: Re: Sprite moving and entity position
Post by: metamorphium on July 22, 2010, 09:37:32 AM
please post your code
Title: Re: Sprite moving and entity position
Post by: Mihulik on July 22, 2010, 10:44:59 AM
The sprite is set in this way: (http://img189.imageshack.us/img189/8679/spritej.jpg)
Title: Re: Sprite moving and entity position
Post by: Mihulik on July 24, 2010, 05:48:45 PM
Nobody knows? I've been spending hours on trying to figure out what's wrong.
But I haven't found any problem yet:-/
Title: Re: Sprite moving and entity position
Post by: maze on July 25, 2010, 08:00:09 AM
Howdy Partner
I would use a different approach: Attach your script in "Scene Edit" to the entity instead of loading it with AttachScript and change the code as following.
Title: Re: Sprite moving and entity position
Post by: Mihulik on July 25, 2010, 02:14:58 PM
Thanks! I'll try it and let you know whether it'll help me :)
Title: Re: Sprite moving and entity position
Post by: Mihulik on July 25, 2010, 07:57:59 PM
It works well. Even more, your solution is much "cleaner" than my one. I didn't know if I place an infinite loop into an entity script, it will work. I'm not so much experienced in WME. ;)
So, I thank you again for the working solution and mainly for the new finding. :)
Title: Re: Sprite moving and entity position
Post by: maze on July 27, 2010, 10:44:12 PM
No Prob.
This reminds me of the time when I was new to WME.