Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Unable to get sprite to move

Author
Message
DennisW
15
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 30th Jan 2012 05:56
I am trying to move a sprite and unless I use 0.51 or greater it will not move. If I use x# = .25 it just sit's there. Then when I goto .51 I think It rounds it up to 1 and moves the sprite. Anybody know what I might be doing wrong.



Thanks
Dennis_W

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Jan 2012 06:47
Are you using the percentage system or the virutal resolution system. Using decimals for positioning sprites in the percentage system should be fine but in the virutal resolution system it may get rounded off since you can't physically position a sprite at a fraction of a pixel.

Looking at your code however, in theory that should work, even if it is rounded off, it should move. Are you using it in a loop with the sync() command? A better question maybe is it being executed inside a loop?

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 30th Jan 2012 12:05
Yes, there just isn't enough code there to make a judgement. Perhaps you could show us some more as it could be anything from not updating the screen to applying the position command to a badly typed variable.

We all make silly mistakes (me as many as anyone else)

One of the well established traditions on the TGC forums is to try to replicate the problem using code anyone here can compile and run. Normally (9/10 times) this resolves the issue before it even hits the forums as you find the problem before someone has a chance to say "You spelled 'HappySouth' wrong!" or something similar.

Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 30th Jan 2012 13:19
Sounds to me as though you have x# defined as an integer and not a float... Change #x to a float and it should move with increments of 0.25
DennisW
15
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 30th Jan 2012 17:16
@Funnell7 Thats exactly what I did it works fine now.
@Baxslash and Hodgey Thanks for the input. Baxslash I will rememberto post more of the code.

Thanks Guy's

Dennis_W

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed

Login to post a reply

Server time is: 2024-05-06 07:06:44
Your offset time is: 2024-05-06 07:06:44