Hello everyone ! I'm re-learning how to use AKG around these days, and as I've been away for many years, I'm kind of lost xD.
let's say I'm a "newbie" again, my question is the following, I'm trying to create simple games to get the "rhythm", I'm trying to create a mechanic that in agk "seems" not to be as complex to implement as in others engines.
I would like to make a mechanic similar to this game below: in which the sprite follows the angle of the mouse pointer and is stopped in a position ddo ViewPort but moves around the World, I'm a little confused on how to apply this correctly in AppGameKit .

+ Code Snippet// Project: MyLearnGame
// Created: 2022-01-11
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "MyLearnGame" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
global sprite
sprite = CreateSprite(LoadImage("sprite_00.png"))
//SetSpriteSize(sprite, 1, 100)
SetSpriteOffset(sprite, GetSpriteWidth(sprite)/2, GetSpriteheight(sprite)/2)
SetSpritePositionByOffset(sprite, 100, 100)
FixSpriteToScreen(sprite,1)
do
Printc("Sprite Angle is ")
Print(Str(GetSpriteAngle(sprite),2)+" Degrees")
x# = GetPointerX()
y# = GetPointerY()
angle# = ATanFull(x#-GetSpriteXByOffset(sprite), y#-GetSpriteYByOffset(sprite))
SetSpriteAngle(sprite, angle#)
MovePlayer()
Sync()
loop
function MovePlayer()
x# = GetSpriteXByOffset(sprite)
y# = GetSpriteYByOffset(sprite)
angle# = GetSpriteAngle(sprite)
speed# = 5.0
if (GetRawKeyState ( 65 )) //LEFT
inc x#, sin(angle#-90) * speed#
dec y#, cos(angle#-90) * speed#
endif
if (GetRawKeyState ( 87 )) //DOWN
inc x#, sin(angle#) * speed#
dec y#, cos(angle#) * speed#
endif
if (GetRawKeyState ( 68 )) //RIGHT
inc x#, sin(angle#+90) * speed#
dec y#, cos(angle#+90) * speed#
endif
if (GetRawKeyState ( 83 )) //UP
inc x#, sin(angle#+180) * speed#
dec y#, cos(angle#+180) * speed#
endif
// in this part if the player is inside the area in the center of the view the sprite image stops moving to the corners of the view, but should it continue to move in the world ? or not ?
if (x# >= 400) and (x# <= GetVirtualWidth() - 400)
if (y# >= 200) and (y# <= GetVirtualHeight() - 200)
SetSpritePositionByOffset(sprite, x#, y#)
endif
endif
// this line camera follow sprite, right ?
SetViewOffset( x#, y# )
endfunction
would you have a tip or an example for me to get inspired and try to replicate and study?
thank you very much for everyone's attention!!