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.

DarkBASIC Discussion / question about keycode and drawing text before(in front) of an image [2d game]

Author
Message
PPvdBosch
21
Years of Service
User Offline
Joined: 14th Dec 2003
Location: Holland
Posted: 3rd Mar 2004 21:27
Hello Dear reader, Please take your time to read this

Question1
I'm making a 2d game with 2 little aircrafts (one at the top of the screen and one aircraft at the bottom of the screen). They can only move left or right.
For the aircraft at the bottom of the screen i've used:
the leftkey() en rightkey() for moving
For shooting i've used the spacekey() command. Shooting and moving AT THE SAME TIME with these command leftkey(), rightkey(), spacekey() works perfect.

The problem is:
It DOESN'T work with keycode 30 and 32 33. (move with "[A]" and "[D]" and shoot with "[F]"). The plane will stop moving when i'm shooting at the some time. (in otherwords: i have to stop moving to shoot a bullet from the top airplane.
Does anybody know the difference between the left,rightkey()and spacekey() and the keycode commands??? How do i fix my problem?

Question2:
At the beginning of code I'm loading a few bitmaps.
(for the background,aircrafts and bullets)
But i cant draw any text in front of it with the print "text here" command.
I really need to draw some text to create a scoreboard.
How do i fix this problem too?

Please help me out

See my code also
[rems are in dutch,funny language you might think]
[The coding might look a bit noob, sorry for that too]
[media not included, but i hope its not important to anwers my questions]

With kind regards Pieter

homepage[www.vbbasics.tk]
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 4th Mar 2004 11:07
For Q1...
The reason that it doesn't work is that ScanCode returns the code of the most recently pressed key.

You might be better off using the InKey$() command.

For Q2...
Instead of using the Print command, try using the Text command, which allows you to specify where on the screen you want to paste your text. Whereas with the Print command, it simply prints it on the next line each loop, thus it prints on the first line right the way through to off the bottom of the screen within half a second of the program starting. This may be why you cannot "see" the text...

Hopefully that helped...
Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
PPvdBosch
21
Years of Service
User Offline
Joined: 14th Dec 2003
Location: Holland
Posted: 4th Mar 2004 14:52
ok thanks jess i will try it today

homepage[www.vbbasics.tk]
PPvdBosch
21
Years of Service
User Offline
Joined: 14th Dec 2003
Location: Holland
Posted: 4th Mar 2004 23:54
alas, it didn't work. When i use the inkey$ command the plane still stops moving. there's no differce.
I can't see any text being drawn with the text$ command either
Is this because of the bitmap???
regards Pieter

homepage[www.vbbasics.tk]
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 5th Mar 2004 05:34
The actuall command is Text not Text$

With the pressing of key's, I'm not too sure...
Sorry..

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy

Login to post a reply

Server time is: 2025-05-23 11:09:29
Your offset time is: 2025-05-23 11:09:29