Store mouse coordinate XY in variables [Solved]

Discussion in 'RPG Maker MV' started by Lakaroth, Oct 25, 2015.

Thread Status:
Not open for further replies.
  1. Lakaroth

    Lakaroth Veteran Veteran

    Messages:
    272
    Likes Received:
    127
    First Language:
    English
    Hello there i'm trying to store in 2 varabiles the XY mouse coordinate, something like that, but i receive result as Zero, they are the wrong variable?

    [​IMG]
    Also, how can i identify the "Mouse Press" button?
    I need that in order to define some clickable areas, like a menù in pictures.
    Best.

    EDIT: Ok it Works!
    It's case sensitive, so the X and Y must be x y no Uppercase.
    How can i define IF CLICK?
     
    Last edited by a moderator: Oct 25, 2015
    #1
  2. Zalerinian

    Zalerinian Jack of all Errors Veteran

    Messages:
    4,695
    Likes Received:
    922
    Location:
    The Internet.
    First Language:
    English
    Primarily Uses:
    N/A
    I see you found out it's case sensitive, nicely done :)

    For checking if the player has clicked, you'll probably want to try TouchInput.isTriggered(), which will return true if the mouse was just pressed down, or a touch screen was just pressed. This only is true once per time, so click and holding the mouse button will only return true once.

    To see if the player is holding the mouse down, or their finger on a touch screen, use TouchInput.isPressed().

    Please note that in both cases, you will need to check the mouse position to see specifically where it was pressed, as this only returns true or false, not the position it was pressed.
     
    #2
  3. Lakaroth

    Lakaroth Veteran Veteran

    Messages:
    272
    Likes Received:
    127
    First Language:
    English
    Perfect it works!!!

    If anyonw need is like this

    [​IMG]
    Best

    Lakaroth
     
    Last edited by a moderator: Oct 25, 2015
    #3
  4. JareX

    JareX Veteran Veteran

    Messages:
    33
    Likes Received:
    8
    First Language:
    Spanish
    Thanks Lakaroth for asking this because I had a similar issue.

    I'm trying to build a custom menu, and I want to make some portions of the screen trigger an event while the mouse is there.

    For that I'm now using the mouse coordinates thanks to you.

    But I have one problem.

    If I click on the desired area the event is triggered, but I want it to activate while hovering the mouse on that area

    The problem is that the coordinates of the variable are only updated when the mouse is clicked

    So, the question is: How do I make the variables update without the need of the mouse click, or else how do I create a conditional branch that triggers when the mouse hovers over an area of the screen?

    PD: Sorry to ask this here, but I think you have this answer.
     
    #4
  5. Lakaroth

    Lakaroth Veteran Veteran

    Messages:
    272
    Likes Received:
    127
    First Language:
    English
     Humm... i see, this is really out of my range i'm not a Javascript programmer, but i want let you think about this:

    Are you planning for a mobile version too?

    Because even if you find a way to updates mouse position coordinates, this work on PC or Web etc etc

    BUT think a mobile game, you don't have the cursor so how can you do that?

    I don't know if u'r planning for a commercial game, in that case you need to realize how many "clients" you can lost without a mobile porting.

    Anyway, i think there ust be a way to update mouse cordinates maybe with mouse system ex i tryi some variable but dont work, ask to the guy who made the plugin!

    Best!
     
    #5
  6. CynicSyndrome

    CynicSyndrome Veteran Veteran

    Messages:
    50
    Likes Received:
    30
    First Language:
    English
    Primarily Uses:
    RMMV
    this method stores pixel coordinates, how do you store grid coordinates??
     
    #6
  7. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,766
    Likes Received:
    10,577
    First Language:
    English
    Primarily Uses:
    RMVXA

    Member, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


    In addition this is a different query. Please post a new thread.
     
    #7
Thread Status:
Not open for further replies.

Share This Page