epsilon1 at June 29th, 2007 16:42 — #1
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,
kulik at June 29th, 2007 16:55 — #2
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.
monjardin at June 29th, 2007 17:20 — #3
You can take a look at the Win32 Console Reference here: http://msdn2.microsoft.com/en-us/library/ms682087.aspx
However, I don't think it will allow for what you want to do...
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.microsoft.com/en-us/library/ms685035.aspx
IMHO, you would be better off taking kulik's approach and using SDL.
epsilon1 at June 29th, 2007 17:30 — #4
alright so if sdl isnt to complex ill try it with sdl