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 / Writing Game. Need Help.

Author
Message
Stedders
20
Years of Service
User Offline
Joined: 7th Oct 2003
Location:
Posted: 6th Jan 2004 10:18
Hey Guys,

I'm starting to make my first full game after I got a ball bouncing off of a paddle, my first project.

I want to make a game where two players can control tanks that can be moved and can fire weapons at there opposition.

I started to write the program but soon realised that I may need some help, here are the points that I need help with.

1. Re writing the program into functions.

I know the way I'm currently writing my program is a little bit archaic so I would like to add some formality to it by using functions, my problem is how do I use them?

I have looked at a couple of Tutorials and Posts but still can't get them to work, can anyone offer advice or examples?

2. Letter/Number Keys

I can use the Arrow keys or other keys such as thwe Shift/Control/Escape key but I can't find the letter or number keys.

How do I check letter keys and use them within my program?

3. Laser

I'm trying to get a laser to fire from one box using this code,



Unfortunatley the line dosn't appear, what am I doing wrong?

Cheers
Luke

Are Games getting worse or our standards getting higher?
Axelman
20
Years of Service
User Offline
Joined: 18th Oct 2003
Location: Parallel Universe
Posted: 6th Jan 2004 10:34
hi luke.
this is the first time i have tried to help someone. are you using dbclassic or dbpro?i will help you in dbclassic. anyways the first thing i reccomend you check out the example game you get with dbclassic, named (ironically) tank. this game is very good, but the tank model is pretty crappy (no offense lee) if you have darkmatter then use a tank model from there (they are really good). also with this example game you could steal a few functions like gravity and collision. now, another thing you could do is check out the code base on this website. functions that are necessary are menu functions, health bar functions, split screen functions(for multi player) and probably ALOT more. now onto that laser thing. drawing a line like that will show up in 2d, not 3d (unless you are trying to make a 2d game) there should be a laser function in the code base.

hope i helped

Axelman

Axel Waz `Ere
Stedders
20
Years of Service
User Offline
Joined: 7th Oct 2003
Location:
Posted: 6th Jan 2004 10:41
Shite!

I knew I'd forget something.

DB Pro

Thanks for the references, but I would like to learn how to do most of it myself and steal only where i have to.

Can anyone give me some good pointers.

Cheers

Are Games getting worse or our standards getting higher?
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 6th Jan 2004 12:41
using the code in the code base is not "stealing"... that's what its there for

The easyest way to learn functions is to assume they are just gosubs and use global variables. Most varaibles need to be global anyway. I think most programmers would set that up first....
Use a global array of UDT (user defined types) and use functions
to manipulate them.

The best part of using functions is hiding them in other files and they still show up in the function list. This helps add some kind of structure to spagetti code.

Create a code module for "strings" and place all functions that manipulate strings or text in that module.

create a module for debugging and place all debugging functions there

create a module for managing your UDT array with those functions..

That should get you started the right way. OH, and a module for your interface stuff....

In your "main" module you only have the main game loop and calls to setup/cleanup stuff in the other modules.

This helps you start small ......
1 - focus on string functions in that module until it works write
2 - focus on your world map stuff in that module
3 - keep updating your debug module as you come up with more things
that need special testing....

internet gaming group
current project http://home.comcast.net/~norman.perry/Archon.html
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 6th Jan 2004 21:19
1. The best way to think of functions is as user defined commands. You would not put your main loop in a function nor would you want to put a since command in a function. DrawLaser would be a good example, it is something that you would use frequently and would tidy up your main loop. Functions are easy to declare and can optionally return a value. For example...

Function DrawLaser(tankID as integer, targetX# as float, targetY# as float)
rem blah blah
ink rgb(255,0,0),0

X1# = object position X(tankID)
Y1# = object position Z(tankID)

X2# = targetX#
Y2# = targetY#

line X1#,Y1#, X2#,Y2#
EndFunction

You can also specify a return value for a function:

Function CheckLaser(enemyID as integer, targetX# as float, targetY# as float)

X1# = object position X(enemyID)
Y1# = object position Z(enemyID)

X2# = targetX#
Y2# = targetY#

rem add wall detection code here...

rem if we're close to the enemy, score a hit
if abs(X1#-X2#) < 5.0 and abs(Y1#-Y2#) < 5.0 then hit = 1 else hit = 0
EndFunction hit

2. Read up on the scancode() command in the help files.

3. Look at your variables again. Your line is a single dot because both X and Y values are the same for the beginning and end of the line.
--
TAZ

Login to post a reply

Server time is: 2024-09-21 15:36:28
Your offset time is: 2024-09-21 15:36:28