Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to Stay on an Image in loop?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Robotkubo




PostPosted: Tue Mar 22, 2016 8:40 am   Post subject: How to Stay on an Image in loop?

Okay, been working on a game and I'm REALLY stuck, I'm doing the main menu, I got it so you can push ('i') and it displays the info screen and I have it so if you push (KEY_ENTER) you go to the game screen, but the thing is if you let go of the Enter key it goes back to the main menu image, How do I get it to stay on the game screen when I push (KEY_ENTER)



Pic.Draw (menu, x, y, picCopy)

Input.KeyDown (chars)
if chars ('i') then
cls
Pic.Draw (info, x, y, picCopy)
end if

if chars (KEY_ENTER) then
cls
Pic.Draw (back, x, y, picCopy)
end if
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Tue Mar 22, 2016 9:05 am   Post subject: Re: How to Stay on an Image in loop?

You're telling your program that it should always draw the menu and that if the Enter key is being pressed, then it should erase everything and draw the "back" image. So as soon as you let go of the Enter key, the game will continue drawing the menu but will no longer be erasing and drawing the "back" image.

Some ideas for you:
1) Have your program "remember" (there are a few ways you could do this) that the Enter key was pressed.
2) Don't have your program trying to draw the menu all the time (maybe only when it needs to).
Gaming Lyfe




PostPosted: Tue Mar 29, 2016 6:30 pm   Post subject: RE:How to Stay on an Image in loop?

Also, Do you need to use Chars? GUI Buttons are very efficient and easy to use, And i have made many easy games to make with them.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: