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 DBPro Corner / any idea what i'm doin wrong with this piece of code?(pop up help menu)

Author
Message
Doldren
18
Years of Service
User Offline
Joined: 18th Jan 2006
Location:
Posted: 1st Apr 2006 19:22 Edited at: 1st Apr 2006 19:24
here it is:
************************************
If F1()=1 and flag = 0
Load Bitmap "imagesHelp01.bmp",6
Get Image 6,80,600
Sprite 6, 0,0,0
Flag = 1
EndIf
If F1() = 1 AND Flag = 1
Delete Sprite 6
EndIf

***********************************
firstly can u use F keys as an input condition?
(the numbers for the get image aren't relevent atm i just put those in as examples)

basically i want it to work so that if the user presses F1, a help box apears in the middle of the screen(and pausing the game loop) then if F1 is pressed again the box is taken away and game loop resumed.

another thing to bear in mind is I already have a sprite loaded above the matrix, heres the code for that(this works)
**************************************
Load Bitmap "imagesSideBar02.bmp", 2
Get Image 2,0,0,200,706
Set Current Bitmap 0
Sprite 1,800,35,2
**************************************

(1 last question save me making another post, where can i start learning the basics of how to incorperate AI?)

Any help greatly apreciated
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 1st Apr 2006 21:17
try this small demo to see how to adapt it to your use.



I'm not getting you down am I, Ho Look! another fancy Door?
FROGGIE!
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: in front of my computer
Posted: 1st Apr 2006 22:49


If you code is used like this in your game then it wont work, this is simply because of the order of the IF statements. Whats happening is that you are loading the sprite and showing it, but straight after it is shown you delete it again because in this loop, the F1 key is pressed and the flag is set to 1 which are the 2 conditions needed for the second if statement. The best way of fixing it is to swap the order of the IF commands and also check if the user has lifted the F1 key and then going into the IF command:

Login to post a reply

Server time is: 2024-09-24 19:26:57
Your offset time is: 2024-09-24 19:26:57