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.

Author
Message
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 27th Dec 2003 19:43
Hey all,I'm making a space invaders type clone and just need to sort out the scoring for it to be finished.I can't work out how to do coz I do this.

and nothing is printed to the screen.If the print command is outside the loop it prints score 0 but dosn't +10 for every sprte hit.
Anyone know what I can do.Thanks.

"fireball"
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 27th Dec 2003 20:11
BTW this isn't all my code so if you need any more just shout

"fireball"
BearCDPOLD
20
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 27th Dec 2003 21:27
I think it may have something to do with where you place your text, but could you just throw all the code in there? I'll check back on this thread.

juvy

Juvenile Industries
Current Project: The First Room (FPS)
Soon to come:An rts, and a snowball fight game
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 28th Dec 2003 00:07
Here it is. Sorry if its a bit of a mess.

"fireball"
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 28th Dec 2003 00:12
wait that was the wrong code.This is right.

"fireball"
Xzander
20
Years of Service
User Offline
Joined: 17th Dec 2003
Location: ... I don't know ...
Posted: 28th Dec 2003 00:50
Hmmm... Maybe if the score was at the start of the loop? Can't test it cuz I dont have the pic files but it should work then.

[ANSWER: 42] [WHO STOLE MY POTATO?!?!]
[LIFE IS THE #1 CAUSE OF DEATH] [THE ONE, THE SINGULAR, THE INSANE]
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 28th Dec 2003 01:04 Edited at: 28th Dec 2003 01:14
Thanks I just tried that but it dosn't seem to work.

"fireball"
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 28th Dec 2003 01:46
It's proberly this
ink rgb(10,10,10),1
rgb(10,10,10) is nearly black so the text won't show up.
if you want white text use
ink rgb(255,255,255),rgb(0,0,0)

Also you don't want to be using the ink command every loop if you don't have to, just use it before the loop if you are going to be justing the same colour all the time.

If you are using dbpro right click in the editor and click rgb colour picker and it will insert the rgb statment for the colour you pick with the windows colour dialog.

dbpro : p166mmx @ 233 : 256mb : sb 128pci : sis onboard
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 28th Dec 2003 13:25 Edited at: 28th Dec 2003 14:08
It should show up because I'm using a blue background but I can only see it if the print command is outside the loop but if I do this it dosn't add 10 for every sprite hit.BTW i'm using DBC

"fireball"
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 28th Dec 2003 15:14 Edited at: 28th Dec 2003 15:15
you will have to dump the automatic sync and do it manualy to get it to work, at the start of the code put

sync on:sync rate 0

sync rate 0 is as fast as your PC can go, so you might want to change to 40 or something, then after the score is printed do a sync

print "score",score
sync

sync tells the system to show all the changes that have been made to the screen since the last change, you can do all sorts of stuff before the sync, move objects, animate them etc, but you won`t see anything happen until you do a sync, so you bneed a sync at the end of your program loop.
the reasons you need to do the manual sync rather than just let DB handle it are twofold, first...your code will run MUCH faster, and second....DB does not handle things smoothly on automatic anyway, and you don`t get things like text displayed properly.
You might also like to consider using text as the command to show your scores, It`s more flexible and faster than print, you would mod the code to read

text 0,0,"Score:-"+str$(score)

and by altering the x and y values you can move the text around the screen easily, also use the text commands to chang from the standard system font to something better and rescale it to make it more visible, etc, cheers.

Mentor.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 28th Dec 2003 15:24 Edited at: 28th Dec 2003 18:35
AAAAAAARRRRRGGGGGGGGGGHHHHHHHHH I put all my code into sub-routines(easier than functions)and did what mentor said and still nothing is written on the screen.This is my new code but I might not of understood mentor fully.Someone please help me put my score on the screen.

"fireball"
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 28th Dec 2003 18:35 Edited at: 28th Dec 2003 19:28
oops forgot to include the code.Thanks.

"fireball"
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 28th Dec 2003 19:45
plz help.

"fireball"
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 28th Dec 2003 21:05
You almost got it.

You only need one sync at the end of your game loop.

Quote: "sync tells the system to show all the changes that have been made to the screen since the last change, you can do all sorts of stuff before the sync, move objects, animate them etc, but you won`t see anything happen until you do a sync, so you bneed a sync at the end of your program loop."


1. Move the SYNC after the DO command to before the LOOP command.
2. Remove the SYNC in your print routine.

I tested your code in DBP and that worked for me.

3. Cosmetic change: add a space after the word 'score' to make it look nicer. The STR$() function does not add a leading space.
--
TAZ
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 28th Dec 2003 21:17 Edited at: 28th Dec 2003 21:19
I did what you said but it still dosn't work. This is how my code looks with the changes I've made. I've done everything I can but it won't work. I know it sounds really lazy but plz plz can someone show me how to do it by changing my code and putting it on the site so I can actually see how they have got it to work.Thankyou so much.p.s. I'm using DBC.

"fireball"
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 29th Dec 2003 05:38
Well, it works for me in DBP.

Since I don't have DBC, I can't offer any more advice.
--
TAZ
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 29th Dec 2003 14:19
O.K. Thanks for your help. Anyone know how to do it in DBC.

"fireball"
GameMaker Jason
20
Years of Service
User Offline
Joined: 22nd Nov 2003
Location: UK
Posted: 29th Dec 2003 19:06
Have you tried putting the sync rate 0 on a different line than sync on.
I'm only a learn but it might work.
I think that the colon inbetween the to commands is a DBPro feature.
P.S. I'm making a space invader clone aswell.

********
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 29th Dec 2003 19:21
You usually dont want to have SYNC RATE 0, as that will let the program run as fast as the computer will allow, which will get out of control on higher end comps.

Sync ON : Sync rate 50

Is usually good, maybe 60

RPGamer


Dont forget to Join the Forums!
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 30th Dec 2003 21:47
Thans to all that helped I can't get it to work and if I still can't in a few days I'll try somfink else.Thanks again.

"fireball"
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 30th Dec 2003 22:04
what screen mode are you in???, make sure you are not in 16bit, I know it has issues in classic with the way the screen is drawn and coloured, start the code with the line

set display mode 640,480,32

if that fails then your gfx card is prolly a 3DFX card, they DO have problems with DB (both DB Pro and Classic incarnations), also make sure you have the latest driver for your GFX card and dx 8.1 installed for classic or dx9.0b for pro, also make sure you have the last upgrade for classic (available off the DB classic section of this site...move the mouse to the top of the page and select darkbasic from the dropdown under game development and navigate to the classic patch) other than that...it SHOULD work, if it doesn`t then it`s an issue with either your GFX card or the directx setup, (onboard graphics chips from won-mo-ting Fx can be a problem too )

Mentor.

System spec : Pentium 3.0Ghz, 512MB DDR, 2x160Gb HD (using icewave hd coolers ), DVD RW/CD RW (all modes), multimedia front panel, 6 way surround sound, ATI radeon 9800Pro 128mb.
Pricey
21
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 30th Dec 2003 22:11
use

text 10,10,"Score "+str$(score)

instead

soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 31st Dec 2003 00:24
Nope it still dosnt work. I do have a NIVIDIA GeForce FX 5200 128mb graphics card. Is this the problem.BTW this is my cose now.Thanks in advance.

"fireball"
Alastair Zotos
20
Years of Service
User Offline
Joined: 30th Dec 2003
Location: a bin
Posted: 31st Dec 2003 02:19
theres probably an image or a sprite in the way or something.

fart like you've never farted before!!!
(five seconds later)
Dude that stinks!!! get out of my house!
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 31st Dec 2003 17:01
I've already checked that.

"fireball"
Mickyfyn
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: UK
Posted: 7th Jan 2004 13:03
Hi Proshooter

I have been watching your problem and it seems that no one has been able to help you. I am a newbie at this as well but I have DBPro. So I can't test what I am saying.

I have read in a book somewhere that DBC does not support global variables and the only way to use your variable(s) throughout your code is to make your variables arrays.

i.e. dim score(1) the 1 referring to the number of elements.

Then refer to score as score(0) 0 being the first element

So score = score+10 would be score(0) = score(0)+10

Then as mentioned before you could put

text 10,10,str$(score(0))

either in a function or gosub (a function would be better) or in the main body of your loop.

This might not help but is worth a try

I can't see in your code anything to set the colour of your text, try putting ink rgb(255,255,255),rgb(0,128,255)

this would set the text colour to white and the background color to what you have now.

good luck
Mickeyfyn

Login to post a reply

Server time is: 2024-09-21 15:33:17
Your offset time is: 2024-09-21 15:33:17