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 / Sprite move to point

Author
Message
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 16th Mar 2014 10:43
Hi

I'm trying to move a sprite to a point, but I don't know why it doesn't work (it work on my purebasic code, but not with AppGameKit code ^^)

Do you know how I can move a sprite to a point (x,y) ?

Thank you.



Another question : I don't understand how does work the "not" code.
In that code, it could be print the line, isn't it ?

So why it doesn't print ?

Thank you for your answer .

http://www.dracaena-studio.com
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 16th Mar 2014 12:09 Edited at: 16th Mar 2014 12:10
Try this instead.



Here is a function to get the angle.


Here is how to move it towards.



I hope it makes sense as I cut it out of my ai sample.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 16th Mar 2014 12:44
you should use # or as float for variables that use decimal places.

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 16th Mar 2014 16:05 Edited at: 16th Mar 2014 16:06
Thanks for your answers, I have found.
Here is the correct code :



Thanks

http://www.dracaena-studio.com
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th Mar 2014 19:14
Your GetAngle function needs to make the inputs as floats and the result needs to be a float as well. What you have now makes them integer values.


And, in the MoveToward function you also need to declare the input variables as floats. And the angle variable needs to be a float as well.


Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 17th Mar 2014 10:08
Hi

Thank you ancient lady for this correction .

http://www.dracaena-studio.com
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th Mar 2014 03:08
Always glad to help (as long as it actually did).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-11-25 03:41:51
Your offset time is: 2024-11-25 03:41:51