Trouble Converting Mouse into Player Object



  • I am creating a game that essentially shoots pixmap objects at the player, and his job is to dodge them for as long as possible. Originally I wanted the players sprite to be tracked to the mouse because this would allow for a lot more mobility on the players side than using keyboard inputs. However, after numerous hours of reading I cannot seem to convert the mouse cursor itself into an object that can detect the collisions or overlay an object to follow the mouse. Any suggestions would be greatly appreciated, thank you for your time.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should add more information like:

    • the Qt version you are using
    • the technology you are using (QtQuick, Graphics View framework, qml-box2d, etc.)
    • the platform you are targeting
      etc.


  • Thanks for the feedback, sorry for the vague nature of the question. I am using the Qt 5.8.0 64 Bit Desktop version, and I am currently building everything inside the Qt Creator itself. I'm setting the scene with QGraphicsScene, and then displaying objects with addItem to the standard scene. This is not being developed for any platform specifically, the program in question is part of my final project for my C++ class. I would also like to apologize if this question is located in the wrong section of the forum. I'm very new to the forum itself and relatively new to Qt in general.


  • Lifetime Qt Champion

    So if I understand you correctly, you'd like to have an item locked on your mouse cursor to move around for your game, while the cursor itself is hidden. Correct ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.