How to Make a Rollover Button

edited November 2014 in How To...

Hi, my name is Tanner and I need help with my High School Coding Project. Currently, I have a drone moving around a google maps screenshot. The drone is controlled by the arrow keys, and when the drone reaches a certain vicinity of the side of the screen, the map moves. But, what I'm having trouble with is making a rollover button for when the drone hovers over it and the user presses key 'f', it will switch screens displaying information. ANy help would be much appreciated, I decided that just putting in the code script wouldn't do any justice, so I'm going to put a link here for anyone to download and look at. PLEASE let me know if you have any questions, I've been working on this specific problem for about a week now and really need some guidance. Thankyou so much, I appreciate it!!!

DOWNLOAD LINK https://drive.google.com/file/d/0B5dyG_2utSA8aWp1LS1XQ05ZTkk/view?usp=sharing

-Tanner

Answers

  • edited November 2014 Answer ✓

    But, what I'm having trouble with is making a rollover button for when the drone hovers over it and the user presses key 'f', it will switch screens displaying information.

    I see a blue airport sign in the 1st map (streets)

    I also see a 2nd map (satellite when I press f)

    I also see a textbox when I hover with the drone over the green rectangle.

    err... it all works... what do you want?

    What is your question exactly? Maybe: how can I make it so that "f" does only work if I hover over the blue airport sign? Or ... what is it...?

    BTW

    Instead of mainmap and airportswitch which are redundant

    think of states:

    state is an int and it can take different int-values you can give names.

    final int stateMapNotHovering = 0; // consts 
    final int stateMapHovering = 1;
    final int stateAirport = 2;
    int state = stateMapNotHovering;  // current
    

    ;-)

  • Thanks for the Reply, I appreciate it!
    YES, I want the user to be able to switch screens by pressing 'f' ONLY when they are hovering over that blue airport icon. How would I do this?

  • Answer ✓

    if (dist(mouseX, mouseY, PosIconX,PosIconY) < 55) {

    }

  • So what I'm trying to do is make it so that the drone hovering over the button will allow the user to change screens, not the mouse. Is there any way to do this?

  • The problem I'm having right now is that the area to hover over moves when the screen moves, and therefore does not stay in the same place. I need to make it stay within that little button area even when the screen moves.

  • Answer ✓

    when f is pressed check

    if (dist(droneX, droneY, PosIconX,PosIconY) < 55) {
    
    }
    

    if true, allow the user to change screens,

  • Thanks for your help man I appreciate it!!!!

Sign In or Register to comment.