PureBasic Game Tutorials???
probably not! That's the Visual Designer for you.....
I think I'll change that to read "only if you're going to use a gadget!"
Thanks Tinman
I think I'll change that to read "only if you're going to use a gadget!"
Thanks Tinman
PC 1:AMD Athlon XP 2000,Geforce 2 MX400 64Mb, Windows 2000
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
Next stage of the game creation tutorial has been posted - Simple Sprites
PC 1:AMD Athlon XP 2000,Geforce 2 MX400 64Mb, Windows 2000
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
Screen Save...
The tutorial says:" ; save screenshot
If KeyboardPushed(#PB_Key_F1)
GrabSprite(#snapshot,0,0,#SCREEN_WIDTH,#SCREEN_HEIGHT)
SaveSprite(#snapshot,"screenshot.bmp")
EndIf"
However, in the actual source code available for download, there is no save screenshot code. I added the code manually myself, and found it didn't work properly, only grabbed a blank black screen.
Nice work. I'm enjoying your tutorial very much.
Lj
If KeyboardPushed(#PB_Key_F1)
GrabSprite(#snapshot,0,0,#SCREEN_WIDTH,#SCREEN_HEIGHT)
SaveSprite(#snapshot,"screenshot.bmp")
EndIf"
However, in the actual source code available for download, there is no save screenshot code. I added the code manually myself, and found it didn't work properly, only grabbed a blank black screen.
Nice work. I'm enjoying your tutorial very much.
Lj
Sorry LJ - the correct source has been uploaded.
The snapshot code has to go just after the first initial keycheck, like so....
;///////////////////////////////////////////////////
;- Input
;///////////////////////////////////////////////////
;check keyboard For input
;if escape pressed, leave program,
;if + or - pressed, change speed of starfield
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape)
done = 1
EndIf
; save screenshot
If KeyboardPushed(#PB_Key_F1)
GrabSprite(#snapshot,0,0,#SCREEN_WIDTH,#SCREEN_HEIGHT)
SaveSprite(#snapshot,"screenshot.bmp")
EndIf
The snapshot code has to go just after the first initial keycheck, like so....
;///////////////////////////////////////////////////
;- Input
;///////////////////////////////////////////////////
;check keyboard For input
;if escape pressed, leave program,
;if + or - pressed, change speed of starfield
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape)
done = 1
EndIf
; save screenshot
If KeyboardPushed(#PB_Key_F1)
GrabSprite(#snapshot,0,0,#SCREEN_WIDTH,#SCREEN_HEIGHT)
SaveSprite(#snapshot,"screenshot.bmp")
EndIf
PC 1:AMD Athlon XP 2000,Geforce 2 MX400 64Mb, Windows 2000
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
next one should hopefully be ready in a couple of days, and will concern animated sprites.
(p.s. sorry for the delay everyone, other commitments etc... )
(p.s. sorry for the delay everyone, other commitments etc... )
PC 1:AMD Athlon XP 2000,Geforce 2 MX400 64Mb, Windows 2000
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
next tutorial available - animated sprites & sounds!
Rgrds everyone
Hypervox
Rgrds everyone
Hypervox
PC 1:AMD Athlon XP 2000,Geforce 2 MX400 64Mb, Windows 2000
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
Nice...
Your latest tutorial is fantastic.
The sounds are functioning, hmmm, how to describe,... in a inconsistent way. Notice that when the program is first run, the background sound voidhum.wav is of a good volume. As the program is running, if you push the space bar which plays phaser.wav it sounds good. But sometimes when you push the spacebar, the volume of the first sound, voidhum.wav, decreases and is hardly audible. The phaser.wav volume decreases also. Now push the space bar a few more times, and if you're lucky, the volume suddenly increases again back to its original volume and everything sounds great. As you push the space bar at different times and different speeds, the sound makes almost a crackle sound, but not quite and again, the volume decreases. Sometimes you are stuck at a decreased volume for both the phaser.wav and the voidhum.wav for a considerable amount of time, but eventually, if you keep pushing the spacebar, you can get the volume to increase again.
I notice that with the PlaySound command, there doesn't appear to be different channel to load the sound as in the Blitz3D language. Could the problem be that because there are not different channels, by repeating the sound before its completely finished cause the decrease in volume?
The logic is that EVERYTIME the program is first executed, the volume is always correct. But when the phaser.wav sound is introduced on the same channel and stopped and started at different times, the volume alternates between a very low and normal state.
And if everyone gets the problem I described above, is this a bug to report to Fred or is it corrected by allowing the phaser sound to fully play and terminate before playing again?
The sounds are functioning, hmmm, how to describe,... in a inconsistent way. Notice that when the program is first run, the background sound voidhum.wav is of a good volume. As the program is running, if you push the space bar which plays phaser.wav it sounds good. But sometimes when you push the spacebar, the volume of the first sound, voidhum.wav, decreases and is hardly audible. The phaser.wav volume decreases also. Now push the space bar a few more times, and if you're lucky, the volume suddenly increases again back to its original volume and everything sounds great. As you push the space bar at different times and different speeds, the sound makes almost a crackle sound, but not quite and again, the volume decreases. Sometimes you are stuck at a decreased volume for both the phaser.wav and the voidhum.wav for a considerable amount of time, but eventually, if you keep pushing the spacebar, you can get the volume to increase again.
I notice that with the PlaySound command, there doesn't appear to be different channel to load the sound as in the Blitz3D language. Could the problem be that because there are not different channels, by repeating the sound before its completely finished cause the decrease in volume?
The logic is that EVERYTIME the program is first executed, the volume is always correct. But when the phaser.wav sound is introduced on the same channel and stopped and started at different times, the volume alternates between a very low and normal state.
And if everyone gets the problem I described above, is this a bug to report to Fred or is it corrected by allowing the phaser sound to fully play and terminate before playing again?
What's happenning is that the Playsound command for the phaser sound is being fired every time the space key is pressed. If you hold down the space key, the sound plays repeatedly. Depending on how fast your keyboard repeat is, this can give the effect of the sound being "chopped off", or even silence!
I don't think the volume itself is changing, but this repeat effect could manifest itself this way.
I think I'll post a query on this, because I'm not happy with this situation. The Windows PlaySound API call can stop a sound if it's already playing, but I think it can also not play a sound if it's already in progress. Let's see what Fred says...
I don't think the volume itself is changing, but this repeat effect could manifest itself this way.
I think I'll post a query on this, because I'm not happy with this situation. The Windows PlaySound API call can stop a sound if it's already playing, but I think it can also not play a sound if it's already in progress. Let's see what Fred says...
PC 1:AMD Athlon XP 2000,Geforce 2 MX400 64Mb, Windows 2000
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
PC 2:Intel P3 1ghz, Nvidia Vanta 16Gb, Windows 2000
Registered Purebasic User
PureBasic Game Creation Site
http://www.hypervox.co.uk/PureBasic/
OK
Ok. I've tried modifying your code to fix, but no luck. I tried just changing the frequency of the hum noise, I tried detecting if the sound was still playing using the initsound command, no luck.
The only thing that would possibly work is to stop game execusion with a delay command until the sound finished, but that would be terrible as far as game playability goes.
What we need is a way to detect if the phaser sound is still playing, and if it is, don't play it again. The problem with using the initsound command to do this is that the other sound, the hum sound is playing in the background and so the initsound command always returns that the sound is busy.
The only thing that would possibly work is to stop game execusion with a delay command until the sound finished, but that would be terrible as far as game playability goes.
What we need is a way to detect if the phaser sound is still playing, and if it is, don't play it again. The problem with using the initsound command to do this is that the other sound, the hum sound is playing in the background and so the initsound command always returns that the sound is busy.