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.

Dark GDK / Need a little of help.

Author
Message
Sara
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location:
Posted: 3rd Jun 2009 20:47
Well I want to do the following, but I'm not achiving my objective:
When the user presses "Shift", the music stops and the image switches to other one.

Help| xD
Sara
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location:
Posted: 3rd Jun 2009 22:41
Alright, I got through it.
Now, I'm having a problem.



But if I click shift it'll display the 2nd pic.
I want to do this:

Shift > Display picture > Shift > Display next picture.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 4th Jun 2009 00:42
depends on the format of your music, but you would use either :

the "sound" command (dbLoadSound() etc) if your music is in .WAV format...
or
the "music" commands (dbLoadMusic() etc) if your music is in .MID or .MP3 format.

you can check for the keypress in your main loop, using the "input" command "int dbShiftKey()" which will return an integer value of 1 if the key is pressed or 0 if it is not..(i dont think that is the ideal or best solution, but it will work for your purposes)

once you have checked for the keypress and it has been detected, calling the appropriate music/sound command to stop the music from the "sound" or "music" command sets(depending on the format of your music as above)

Changing the image is just as easy.... have a look through the help file that comes with DarkGDK, most of the commands are prety self explanatory just by their names, but the help file also contains some useful usage information.

Its best to work out the actual code yourself, as you will learn the techniques better that way. (however if you still have trouble, post your code here and im sure someone will be able to help you sort it out)

Good luck.

If it ain't broke.... DONT FIX IT !!!
Sara
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location:
Posted: 4th Jun 2009 19:13
Yay I did it. Yet, I'm having problems with what I posted before...



Instead of display the 1st image, it displays the 2nd one.
What I want to do is:
Shift > Display picture > Shift > Display next picture.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 4th Jun 2009 21:29
It is not enough just to write the dbShiftKey checks twice after each other. The keypresses are detected very quickly and a keypress lasts much longer than a frame. So both dbShiftKey checks will be true.

First of all, you need a boolean flag to keep track of when the Shift key is released after having been pressed, then you need other flags to check whether the first or the second picture needs to be displayed. Try this:

Sara
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location:
Posted: 4th Jun 2009 21:47
Yay.
Now, I have more images to display, from menu 1 to menu8.
What do I exactly do in this case?
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 5th Jun 2009 09:03
Somehow I suspected that will be the next question...
In a way, that is even easier. Keep an integer variable which stores the number of the image to be displayed, like this:




This will cycle through all 8 images, then no image, then from 1 to 8 again. If you want to go back to number 1 without the "no image" stage, then in this line:
if (ImageDisplayed > 8) ImageDisplayed = 0;
just change 0 to 1.
Sara
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location:
Posted: 5th Jun 2009 17:47
YAY! Thankyou... but is there anyway to stop this infernal loop? :p
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 5th Jun 2009 20:21
Of course there is, but what exactly are you trying to achieve? Display all eight images like a slide show and then just stop the program? How do you want it to work?
Sara
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location:
Posted: 5th Jun 2009 20:46
Display the eight images > Main Menu
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 5th Jun 2009 23:42
This is a really simple thing your trying to do here, if you have msn I could help you through it just add me kyle.klouzal@gmail.com

Login to post a reply

Server time is: 2024-11-05 23:06:09
Your offset time is: 2024-11-05 23:06:09