Forum Thread
Search
by member
  Posts  
HL2 2D Shooter Top Down. (How I move crosshairs in front of player?9 (Forums : Coding & Scripting : HL2 2D Shooter Top Down. (How I move crosshairs in front of player?9) Post Reply
Thread Options
Oct 4 2009, 2:11pm Anchor

I have created HL2 Top down 2d shooter. Now The crosshairs is still drawn on the player... How do I move the crosshairs forward in front of player? Or have a dynamic crosshairs which you move with ur moouse like in cs2d?

Oct 16 2009, 10:47am Anchor

games like cs2d are done with flash or C++, i i guess your doing this with hl2 and mapping, in other words get a coder.

1337FeRReT
1337FeRReT Technician Elite
Oct 17 2009, 7:55am Anchor

I think thats what he was trying to achieve by posting here.
djjonastybe, I would recommend checking out the crosshair code to see how they achieve drawing it, then position it according to your standards (ie
pseudocode:
if ( getMouse->moved )
{
   crossHair.position = getMouse->getScreenCoord();
}

hacky code I know, but its an example. If I were more awake and it wasnt 2am I would try and take a look but I think id best sleep, good luck btw. Its not too hard just keep at it and btw, congrats on your progress =P

best of luck,
Josh

Edited by: 1337FeRReT

Nov 7 2009, 9:43am Anchor

I understand the code. But if I knew where to put it things would get a lot easier... I am still trying to get the camera in 2D Top Down

I just want to have anice 2D game with bloom and HDR effects :)

Not to mention I will have to limit y-axis to 0degrees
So will I have to remove crouching as well.

Wraiyth
Wraiyth That Guy Who Does Those Things With The Stuff
Nov 7 2009, 4:39pm Anchor

There was a 2D Sidescrolling mod released for Source, AntFarm 2D or something along those lines, and they open sourced their code. If you take a look at how they did the side-on camera, it will give you an idea of what you need to do in order to get your camera top-down.

For painting the crosshair, check out hud_crosshair.cpp. Its drawn in the CHudCrosshair::Paint() function at the center of the screen. The general idea here would be to change this logic to get the mouse position and draw the crosshair there instead. To get the mouse position, check out all the input functions (in_main.cpp/h and iinput.h). I won't give you exact code on how to do it coz learning is part of the process :)

Nov 10 2009, 6:07am Anchor
Wraiyth wrote:There was a 2D Sidescrolling mod released for Source, AntFarm 2D or something along those lines, and they open sourced their code. If you take a look at how they did the side-on camera, it will give you an idea of what you need to do in order to get your camera top-down.

For painting the crosshair, check out hud_crosshair.cpp. Its drawn in the CHudCrosshair::Paint() function at the center of the screen. The general idea here would be to change this logic to get the mouse position and draw the crosshair there instead. To get the mouse position, check out all the input functions (in_main.cpp/h and iinput.h). I won't give you exact code on how to do it coz learning is part of the process :)


Gotta love wraiths, ill give you advice but not tell you how attitude =]
He is the true guy who does those things with the stuff, fan group anyone? :P

Nov 10 2009, 12:10pm Anchor
Wraiyth wrote:There was a 2D Sidescrolling mod released for Source, AntFarm 2D or something along those lines, and they open sourced their code. If you take a look at how they did the side-on camera, it will give you an idea of what you need to do in order to get your camera top-down.

For painting the crosshair, check out hud_crosshair.cpp. Its drawn in the CHudCrosshair::Paint() function at the center of the screen. The general idea here would be to change this logic to get the mouse position and draw the crosshair there instead. To get the mouse position, check out all the input functions (in_main.cpp/h and iinput.h). I won't give you exact code on how to do it coz learning is part of the process :)


Well you have a valid answer, I already knew of the mod's existence, but I can't find their code anywhere... All links to the mod are plain DEAD. So I have always tried to look for alternative, which i never found actually... Can you send me those files maybe?

Wraiyth
Wraiyth That Guy Who Does Those Things With The Stuff
Nov 10 2009, 4:16pm Anchor

Try Web.archive.org
Right click on the links and hit Save As, should pull them down for you.

Nov 11 2009, 5:25am Anchor
Wraiyth wrote:Try Web.archive.org
Right click on the links and hit Save As, should pull them down for you.

Thanks, you just helped me with something I was trying to find for 2 years. Now I will figure out how to use this patch files myself:) I can read them with notepad. I guess they can be used with Visual Studio to patch the project files

Varsity
Varsity Fine Nonsense!
Nov 11 2009, 7:36am Anchor

Check the readme, it tells you how to use the files.

The download is on ModDB now, in case it disappears from the web archive for some reason.

Nov 11 2009, 10:48am Anchor
Varsity wrote:Check the readme, it tells you how to use the files.

The download is on ModDB now, in case it disappears from the web archive for some reason.


lol I also uploaded in on moddb today:D I uploaded it as a mod in the mod section :)

I will try yours first.

Reply to Thread

Only registered members can share their thoughts. So come on! Join the community today (totally free) and join in the conversation.