1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

How to make object fade when key not pressed and then opaque when it is pressed?

Discussion in 'Programming' started by FactorX12, Aug 24, 2018.

  1. FactorX12

    FactorX12 Member

    Jul 24, 2018
    So I am trying to make an inventory that is completely opaque when the player holds the tab key, and then fade out when the player releases the tab key. Is this possible? This is my current code:
    [in the step event]:
    check_tab = keyboard_check(vk_tab);
    image_alpha -= 0.05;
    if check_tab {
    image_alpha = 100;
    the problem with this is it fades out in the beginning, it appears when the tab key is pressed, but when the tab key is released, it stays opaque and does not fade out. any help at all?
  2. Simon Gust

    Simon Gust Member

    Nov 15, 2016
    That's because it will take 33 seconds for you to notice that it becomes opaque. Usually, 100% opaque is at an image_alpha value of 1, not 100.
    dannyjenn likes this.

Share This Page