Hello everybody I am new here and to C++ coding, i know all the basics so i decided it would be fun to just write a fun Ascii game.
here is my idea for the game:
so i am making the game so it draws X's (enemys) all over the screen randomly and your goal is to shoot all the x's (click them lol).
so far i have the function that draws the screen, draws the enemys randomly.
i just need to write a function to see if the person hit or missed (when trying to "shoot" the enemy's)
so i know i have to use get cursor pos, and have to compare it to see if there is an enemy where the cursor is then check to see if the person clicked (i know the key codes)
so i was just wondering if some one could give me som insight on how to do that.
p.s im making it in a console window lol, so no win32 bs.
thanks in advance,
Epsilon
C++ help please
Started by Epsilon1, Jun 29 2007 08:42 PM
3 replies to this topic
#1
Posted 29 June 2007 - 08:42 PM
#2
Posted 29 June 2007 - 08:55 PM
I am not sure what you mean by console window, but as far as I know, you can't simply get mouse position in this mode.
I would suggest you to do it in SDL, it isn't much more complicated than that and your game will be fancier. Also getting input via SDL is very straightforward.
www.libsdl.org
I would suggest you to do it in SDL, it isn't much more complicated than that and your game will be fancier. Also getting input via SDL is very straightforward.
www.libsdl.org
#3
Posted 29 June 2007 - 09:20 PM
You can take a look at the Win32 Console Reference here: http://msdn2.microso...y/ms682087.aspx
However, I don't think it will allow for what you want to do...
EDIT:
I take that back. It looks like you can grab the character coordinate of a mouse click by retrieving a MOUSE_EVENT_RECORD structure with the ReadConsoleInput function. See an example here: http://msdn2.microso...y/ms685035.aspx
IMHO, you would be better off taking kulik's approach and using SDL.
However, I don't think it will allow for what you want to do...
EDIT:
I take that back. It looks like you can grab the character coordinate of a mouse click by retrieving a MOUSE_EVENT_RECORD structure with the ReadConsoleInput function. See an example here: http://msdn2.microso...y/ms685035.aspx
IMHO, you would be better off taking kulik's approach and using SDL.
#4
Posted 29 June 2007 - 09:30 PM
alright so if sdl isnt to complex ill try it with sdl
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











