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 0 error with functions

Author
Message
Matt Harper
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location: UK
Posted: 12th Aug 2012 10:34
Hi, could anyone help me please? I think I'm doing something fundamentally wrong. Whenever I put the code to control the player in the main loop it works fine but when I do it as a function I get the error "Sprite 0 does not exist at line 40" (Line 40: setSpritePhysicsVelocity(faceman,GetVirtualJoystickX(1)*30, - getSpritePhysicsVelocityY(faceman))

Thanks for your help,

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 12th Aug 2012 11:16
You need to make faceman global by declaring outside of the function

global faceman as integer

Matt Harper
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location: UK
Posted: 12th Aug 2012 13:13
Thank you so much, that worked perfectly. Cheers for getting back so quickly.

Login to post a reply

Server time is: 2024-05-06 18:09:26
Your offset time is: 2024-05-06 18:09:26