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 Studio Chat / Please Help I'm making a simple multiplayer soccer game and it works in AGK 2 but not studio?

Author
Message
DMJ
12
Years of Service
User Offline
Joined: 6th Sep 2011
Location: Australia
Posted: 19th May 2019 03:51
I keep on getting a sprite 0 not found error! So weird.

Thank you

Attachments

Login to view attachments
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
DMJ
12
Years of Service
User Offline
Joined: 6th Sep 2011
Location: Australia
Posted: 19th May 2019 04:15
I cant find it, Ive looked and looked.
DMJ
12
Years of Service
User Offline
Joined: 6th Sep 2011
Location: Australia
Posted: 19th May 2019 04:22
I think its a problem with AppGameKit Studio cause the code works in classic
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
DMJ
12
Years of Service
User Offline
Joined: 6th Sep 2011
Location: Australia
Posted: 19th May 2019 04:46

Well thank you for taking a look. I hope I can get some help. I really needed this project.
Dark Raven
9
Years of Service
User Offline
Joined: 27th Jul 2014
Location: United States
Posted: 19th May 2019 07:48 Edited at: 19th May 2019 07:50
I just tested your attached code in both studio and classic and I get that error message when ever I click the mouse. The problem lies some where in the sprite hit area. It isn't detecting a hit on a sprite so localSprite isn't getting assigned a value of the sprite so it is reading it as 0 and there isn't a sprite 0 and that is why the message is popping up. I changed the hit if statement to check if the hits are with main_host and main_client and I was able to select one of those sprites and everything works unless you click anywhere else first then the error pops up because of the localSprite not getting assigned anything but 0. Now how to fix it I didn't dive into the code but that is the issue that is coming up from what I can tell.

On the studio issue thing. Right now studio and classic uses the same compiler and player so how code runs will run the same. The alpha release of studio is for testing the IDE itself. They haven't released the updated compiler and engine yet.
DMJ
12
Years of Service
User Offline
Joined: 6th Sep 2011
Location: Australia
Posted: 19th May 2019 10:11
May I please get a zip of that fix bro?
Dark Raven
9
Years of Service
User Offline
Joined: 27th Jul 2014
Location: United States
Posted: 19th May 2019 12:02
A couple things. 1) what is the red square and green square that the user is to select? 2) on that initial GetPointerPressed() check you are checking for sprite hit. You specify red sprite as 11 and green sprite as 12. What are these sprites? I'm not seeing those sprites as being created so these sprites are never registering as being hit so the global variable localSprite isn't getting set to either Main_Host or Main_Client sprites so on line 173 where you are assigning originalx# and originaly# to the localSprite's X and Y it is looking for the X and Y position of the sprite id 0 as 0 is what is assigned to localSprite's variable. That is what is causing the Error.

I don't have a true fix as I'm not really sure what is needing to be selected. You do need to do some kind of condition if some other sprite is hit as you will get that sprite 0 error if user clicks any other sprite.

What I did to test things is where you have if(hit=11) I changed it to if(hit = Main_Host) and you code if(hit=12) changed to if(hit=Main_Client) then when the characters are selected you won't get that error message and you can move around the character that was selected. The problem lies in that you don't do any detection of other sprites being selected and when that occurs you will get that sprite 0 error. And unfortunately not sure how to resolve the issue but you may check at that area in you code as that is where the problems are.

Login to post a reply

Server time is: 2024-04-20 05:38:01
Your offset time is: 2024-04-20 05:38:01