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 / Problems With Deleting AGK Sprites From Screen?

Author
Message
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 3rd May 2017 02:17
Hi,

I can't seem to remove AppGameKit Sprites from the screen.

Doing the following code removes the Sprite but a white rectangle is left where the Sprite was last displayed?
_______________________________________________________________________________________________________________________________
// Do below on screen 1st load:
LoadImage ( 3, "\media\images\16BitSoftLogo.png" )
SixteenBitSoftLogo = CreateSprite ( 3 )
SetSpriteOffset( SixteenBitSoftLogo, (GetSpriteWidth(SixteenBitSoftLogo)/2) , (GetSpriteHeight(SixteenBitSoftLogo)/2) )
SetSpritePositionByOffset( SixteenBitSoftLogo, ScreenWidth/2, ScreenHeight/2 )

// Wait for timer or user input to advance screen...

// Do below right before showing next screen:
DeleteSprite(SixteenBitSoftLogo)
DeleteImage(3)
_______________________________________________________________________________________________________________________________

Any help would be appreciated, thanks!
JeZxLee
16BitSoft Inc.
Video Game Design Studio
http://www.16BitSoft.com
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 3rd May 2017 02:59
Hi Again...

Here is the complete AppGameKit project folder with all resources in compressed ZIP format:
http://16bitsoft.com/files/PA3/Alpha/PixelArtist3.zip

I am on Linux but it should also load on Windows too.
Hope someone sees what we are doing wrong, thanks!
JeZxLee
16BitSoft Inc.
Video Game Design Studio
http://www.16BitSoft.com
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd May 2017 03:47 Edited at: 3rd May 2017 03:48
When you first reference "SixteenBitSoftLogo" it is within the function DisplaySixteenBitSoftScreen() so it is not persistent.
You should declare it as global in main.agc

If you spend a little time and get to know the debugger these issues will be easier to resolve
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 3rd May 2017 04:06
Hi!

Yup, that fixed the problem we had!

Here is the current version live on our website:
http://16bitsoft.com/files/PA3/HTML5/PixelArtist3.html

Continuing with development...
JeZxLee
16BitSoft Inc.
Video Game Design Studio
http://www.16BitSoft.com
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd May 2017 04:28
if you add
#option_explicit

at the top of your source file it will force the compiler to flag undefined variables. annoying at first but very helpful later on

Login to post a reply

Server time is: 2024-04-25 14:43:16
Your offset time is: 2024-04-25 14:43:16