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.

Newcomers AppGameKit Corner / I cant move my sprite

Author
Message
REvenge_gamES
2
Years of Service
User Offline
Joined: 13th May 2021
Location: Chile
Posted: 20th May 2021 14:27
To start in AppGameKit, always i code a simply topdown movement game.
i read the documentation and i made this

Main.agc

Keycodes.agc

and finally Functions.agc


i dont know why, but the sprite doesnt move.
pls, some halp
PD: Sorry for my bad english
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 20th May 2021 16:39
It won't move.
You are positioning the the sprite at Playerx, Playery every time through the loop and those variables never change.
hendron
8
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 20th May 2021 17:01 Edited at: 20th May 2021 17:06
primitive variable types such as floats and integers cannot be passed by reference to functions. Your Move function is only working on the SpriteX and SpriteY argument variables locally and then getting rid of them. Your Playerx and Playery variables never get changed. You can pass user-defined types by reference, however.


REvenge_gamES
2
Years of Service
User Offline
Joined: 13th May 2021
Location: Chile
Posted: 3rd Jun 2021 00:18
@Hendron, What is 'ref'?
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 3rd Jun 2021 01:40 Edited at: 3rd Jun 2021 01:41
Quote: "What is 'ref'?"

See Passing by Reference 1/2-way down this Help page.
[My Itch.io Home] [Community Apps on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]

Login to post a reply

Server time is: 2024-04-24 21:25:58
Your offset time is: 2024-04-24 21:25:58