Begin stept, end step!?

Discussion in 'Programming' started by DirtyBlasion, Sep 21, 2016.

  1. DirtyBlasion

    DirtyBlasion Member

    Joined:
    Sep 2, 2016
    Posts:
    163
    So I really dont understand what does begin step and end step... the what does step? Im really confused. Please give me some example cases of this. I heard they are making very handy...

    I used only step on things like this

    I read the manual...
     
  2. Dudeidu

    Dudeidu Guest

    The Step event only processes after each instance has run their Begin Step Event
    The End Step event only processes after each instance has run their Step Event.
     
    Josh Chen likes this.
  3. obscene

    obscene Member

    Joined:
    Jun 21, 2016
    Posts:
    2,424
    All objects will run a Begin Step event.
    THEN, all objects will run a Step event.
    THEN, all objects will run an End Step event.
     
    Josh Chen and Bentley like this.
  4. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,881
  5. DirtyBlasion

    DirtyBlasion Member

    Joined:
    Sep 2, 2016
    Posts:
    163
    Hmm, things are a little bit clear, but I can use them for detecting value change?

    And how?
     
  6. obscene

    obscene Member

    Joined:
    Jun 21, 2016
    Posts:
    2,424
    Built in variables ( speed, hspeed, vspeed, image_speed ) will cause their effects (moving an object, etc) after the Step Event, before the End Step event.

    So depending on what you are doing you can get a value in the step event (save to a new variable) and then compare them in the End Step event to see if they changed.

    // Step Event
    myVariable = x

    // End Step
    if myVariable != x changed=true;
     
  7. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,881
    You can only read xprevious and yprevious during the End Step and Draw events, by the way. Didn't mention that in the post I linked. So you pretty much need the End Step event. You can usually get by without using the Begin Step event ever, but it has its uses.
     
    JCJ and Alberto like this.
  8. Hector D

    Hector D Member

    Joined:
    Jan 4, 2018
    Posts:
    3
    very usefull thanks
     
  9. NeZvers

    NeZvers Member

    Joined:
    Mar 24, 2018
    Posts:
    320
    Also objects that are higher in resource tree will run step event (and other events) before objects that are lower in resource tree.
     
    DaMuffin likes this.
  10. yaragad

    yaragad Member

    Joined:
    Mar 4, 2018
    Posts:
    25
    Very interesting. I am always concern about execution order and being careful. So this will keep the code cleaner and ordered. Im refactoring my 1.4 software lol.

    Nice work this 2.0. The Yoyo effort really worth.
     

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