1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Draw event running before create event

Discussion in 'Legacy GameMaker Community Tech Support' started by Neil Roberts, Jun 17, 2019.

  1. Neil Roberts

    Neil Roberts Member

    Jun 17, 2019

    I have looked around for a solution to this with no luck.

    I have a variable declared in a create event which is then used in the draw event of the same object. However when I run my program it gives me the "variable not set before reading it " error. I have disabled (commented out" all the code in both events and added a show_message command and discovered that the draw event runs first followed by the create event, I even added a show_message to the creation code of the instance in the room editor this one runs last of all. I am pretty sure this should not happen but it definitely is.

    Any suggestions? I even created a new object with just a create and draw, and with only show_message commands and it is the same.

    Forgot to mention I am using GM V1.4.1757
    Last edited by a moderator: Jun 18, 2019
  2. William Dubois

    William Dubois Member

    Jun 19, 2019
    Try to create an object and in the create event type this code ''image_speed = 0.1;'' (without '') after in the same object add the event ''animation end'' and now add your draw event. Is it works now?
  3. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Apr 13, 2016
  4. Yal

    Yal GMC Memer GMC Elder

    Jun 20, 2016
    Workaround if you don't want to update: set the object to invisible in the object editor. Set visible to true in the create event. (The Draw event isn't run at all when an object is non-visible)

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice