Jump to content


C++ help please


3 replies to this topic

#1 Epsilon1

    New Member

  • Members
  • Pip
  • 2 posts

Posted 29 June 2007 - 08:42 PM

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

#2 kulik

    Member

  • Members
  • PipPip
  • 41 posts

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
The Eleventh - completely open source RPG game
Tenuity3D - cross-platform OpenGL game engine

#3 monjardin

    Senior Member

  • Members
  • PipPipPipPip
  • 1033 posts

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.
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*

#4 Epsilon1

    New Member

  • Members
  • Pip
  • 2 posts

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