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 / Newbie button help

Author
Message
rockethippo
10
Years of Service
User Offline
Joined: 25th Nov 2014
Location: Canada
Posted: 25th Nov 2014 02:37
What I'm trying to do it have "rainbow.jpg" show if the button with image "jumped.png" (assigned to variable "left") is not pressed, while "heman.jpg" will show if it is pressed. What currently happens is that rainbow.jpg will show on the screen with no button.

SetWindowTitle( "Don't let go!" )
SetDisplayAspect(16/9.0)


// set display properties

SetOrientationAllowed( 0, 0, 1, 1 )


left=CreateSprite(LoadImage("jumped.png"))
SetSpriteSize(left,20,-1)
SetSpritePositionByOffset(left,0,50)
SetSpriteOffset(left,0,GetSpriteHeight(left)/2)


do
if GetVirtualButtonState(0)=1

heman=CreateSprite(LoadImage("heman.jpg"))
SetSpriteSize(heman,100,100)

else

SetVirtualButtonVisible(0,1)
SetVirtualButtonActive(0,1)
AddVirtualButton(0,50,50,50)
SetVirtualButtonImageUp(0,left)
SetVirtualButtonImageDown(0,left)

rainbow=CreateSprite(loadimage("rainbow.jpg"))
SetSpriteSize(rainbow,100,100)

endif

Print( "I said hey!")
Sync()
loop


Can someone please help?
Thanks!
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 25th Nov 2014 04:44 Edited at: 25th Nov 2014 04:44
Virtual button indexes start at 1, not 0. Also, you should load your "heman.jpg", "rainbow.jpg", and virtual button outside of the main loop and hide/show them instead.

Give this a try:





Sean

Login to post a reply

Server time is: 2024-11-25 11:25:20
Your offset time is: 2024-11-25 11:25:20