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 / FPS crosshairs

Author
Message
Dark Serpent
21
Years of Service
User Offline
Joined: 24th Feb 2004
Location: U.S.A.
Posted: 25th Feb 2004 23:37
How the heck do you put cross hairs in your first person shooter. If the answer is to draw it, then how do you get it to stay in one spot while moving the camera around.

$$$Serpant$$$
Douglass
21
Years of Service
User Offline
Joined: 28th Aug 2003
Location:
Posted: 25th Feb 2004 23:51
circle x,y,radius

Dark Serpent
21
Years of Service
User Offline
Joined: 24th Feb 2004
Location: U.S.A.
Posted: 25th Feb 2004 23:53
what the heck does that mean

$$$Serpant$$$
Debbie McDowell
21
Years of Service
User Offline
Joined: 14th Oct 2003
Location: Florida
Posted: 26th Feb 2004 00:35 Edited at: 26th Feb 2004 00:44
REM you will have to include DRAW TO FRONT command
or this sight will vanish behind any other object.

I dont recommend using draw to front items in big complex games as it
tends to rob you of frame rates.
Better is an actual 3d model of a gunsight, locked to window
and positioned as shown in code snipet.

These are center coordinates to position the gunsight
on an 800 x 600 screen setting so if you have the game set at a dift resolution you will of coarse have to change the postioning to match the center.

I do not understand what you mean by NOT MOVE AROUND when you move the camera. This is exactly what you should WANT it to do.

I have included code.
I did not want to do this because here I did it FOR you instead of helping
you to learn. Good for you that I could not find the example in the tutorials to refer you to... to find it yourself..

CLICK THE SORCE BUTTON BELOW

good luck in your efforts
Dark Serpent
21
Years of Service
User Offline
Joined: 24th Feb 2004
Location: U.S.A.
Posted: 26th Feb 2004 00:54
Thanks Debbie McDowell! I'm just a beginer and not very good yet. I'm just bored reading all those tutorials. Thanks any way

$$$Serpant$$$
Dark Serpent
21
Years of Service
User Offline
Joined: 24th Feb 2004
Location: U.S.A.
Posted: 26th Feb 2004 01:03
Hold on! This is great but the crosshair moves to the side whenever I or the enemy shoots. I dont get it

$$$Serpant$$$
Debbie McDowell
21
Years of Service
User Offline
Joined: 14th Oct 2003
Location: Florida
Posted: 26th Feb 2004 03:08
Sorry about that.
What I gave you was a part of another feature I had been working on
and left it laying around named 'gunsight' so just copied it.

I have attached the proper code, the screen size is correct if you are running at 800 x 600
Dark Serpent
21
Years of Service
User Offline
Joined: 24th Feb 2004
Location: U.S.A.
Posted: 26th Feb 2004 06:01 Edited at: 26th Feb 2004 06:04
Sorry but the same dang thing keeps happening! I cant figure out why a crosshair would move if it is drawn in certain on spot. I'll try to find out but I'm not sure whats wrong.

$$$Serpant$$$
hyrichter
21
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 26th Feb 2004 06:37
Try this code that I used:


I hope it works for you.
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 26th Feb 2004 22:16 Edited at: 26th Feb 2004 22:17
- you make a plain and texture it with a cross hair texture

make object plain 1,2,2
load image "crosshair.bmp",1
texture object 1,1

- you lock the plain unto the screen and position it reasonably

lock object on 1
position object 1,0,0,1

you may have to tweak some of the values, like the plain size and crosshair texture etc.

This is the simplest way but not the way i would do it. I would make a plain alright, texture it, disable it's zdepth and position it ahead of the character... so when it's time to shoot bullets all i would do is position bullet at camera position, point to the crosshair and fire... but that's another story

Dark Serpent
21
Years of Service
User Offline
Joined: 24th Feb 2004
Location: U.S.A.
Posted: 26th Feb 2004 23:29
I knew that. lol

$$$Serpant$$$
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 26th Feb 2004 23:46
ps you shouldn't be using 2D in a 3D game, they hate each other you could loose fps easily...

Dark Serpent
21
Years of Service
User Offline
Joined: 24th Feb 2004
Location: U.S.A.
Posted: 14th Mar 2004 19:17
Is there a 3D object I can use?

$$$Serpant$$$
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 14th Mar 2004 19:25
Yes, you could use a plain and texture that.

Its not a bug, its a feature!
Tim Ballisto
21
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Right behind you.
Posted: 14th Mar 2004 20:52
use a plain, draw the background of the crosshair black, lock it on screen, and use set object x,1,0,1 to make the black transparent.
Dark Serpent
21
Years of Service
User Offline
Joined: 24th Feb 2004
Location: U.S.A.
Posted: 15th Mar 2004 00:06 Edited at: 15th Mar 2004 05:21
I got it. Thanks guys

$$$Serpant$$$

Login to post a reply

Server time is: 2025-05-23 08:31:26
Your offset time is: 2025-05-23 08:31:26