Hi all,
I am a beginner and I start learning from Youtube toturial. Running AGK2 classic from Windows 10 Pro x64 laptop.
When I go to lesson two "AppGameKit Tutorial #02 - Load an image, create a sprite and move it!" (see link#1 below), I found I can't move my sprite even using the same code. So I go to Home>Examples>Joysticks page, copy same code , modify only image filename, try run it and the sprite still not move, even the on screen GetSpriteX, and GetSpriteY always show 0. Also I try plug a full size USB keyboard into my laptop and still not working. Here is my code, hope someone can help me.
SetVirtualResolution ( 320, 480 )
CreateSprite ( 1, LoadImage ( "smile64.png" ) )
SetSpritePosition ( 1, 160, 200 )
SetJoystickScreenPosition ( 50, 300, 64 )
do
x# = GetJoystickX ( )
y# = GetJoystickY ( )
Print ( x# )
Print ( y# )
SetSpritePosition ( 1, GetSpriteX ( 1 ) + x#, GetSpriteY ( 1 ) + y# )
if ( GetSpriteX ( 1 ) < 10 )
SetSpriteX ( 1, 10 )
endif
if ( GetSpriteX ( 1 ) > 260 )
SetSpriteX ( 1, 260 )
endif
if ( GetSpriteY ( 1 ) < 10 )
SetSpriteY ( 1, 10 )
endif
if ( GetSpriteY ( 1 ) > 430 )
SetSpriteY ( 1, 430 )
endif
Sync ( )
loop
Link #1:
https://www.youtube.com/watch?v=lOdDfiMNMvM
Regards,
Stanley Hsu