Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Processing - change image on click

  • 01-04-2014 4:06pm
    #1
    Registered Users, Registered Users 2 Posts: 2,608 ✭✭✭


    Im doing a little project using Processing which has a play button which moves a vertical line across the screen which creates a different sound depending on what lines are drawn. What I want to happen is have a pause button image appear when the play image is clicked and vice versa. So when it is stopped, the play image is visible and when it is playing, the pause button is visible.

    I have it working for the Play button, which also stops as i have the code set up in a way saying that if the mouse is clicked within the co-ords of the image, it will play or stop it.

    The code i have is:
    void draw()
    {
    // Show Play/Pause button
    image(play_but, 475, 370, 50, 50);
    }

    void mousePressed()
    {
    // if play/pause button is clicked
    if( (mouseX > 425 && mouseX < 525) && (mouseY > 370 && mouseY < 420))
    {
    drawing = false;
    cursor(HAND);

    if(playing == false)
    {
    playing = true;
    }
    else
    {
    playing = false;
    }
    }
    Tagged:


Advertisement