none
Program.Delay( ) RRS feed

  • Question

  • Apparently the operation Program.Delay (xxxx) should be performed each once the image moves
    I.e. I can not indicate a "delay" and to keep it equal until I expressly indicated it.
    Not all at once I can indicate a certain delay and every time you move the forms do so with this delay?
    Sorry for my English
    Many thanks,

    carlosfmur - Buenos Aires
    Sunday, January 22, 2012 4:27 PM

Answers

  • The Program.Delay is only there in most cases to slow the movement so we can see it, a delay of 20ms is 1/50th sec and corresponds to about 50 frames per second (fps).

    The value for the delay can be a variable holding a number of ms, sometimes this can be useful to just delay upto a value, taking into account time spend actually doing the movement or associated calculations.

    While ("True")
      start = Clock.ElapsedMilliseconds 'time at start of time-step
      
      'Do all calculations and drawing movement here
      
      delay = 20 - (Clock.ElapsedMilliseconds-start) 'Time to delay accounting for time spent doing the work up to 20ms
      If (delay > 0) Then
        Program.Delay(delay)
      EndIf
    EndWhile


    Sunday, January 22, 2012 4:38 PM
    Moderator

All replies

  • The Program.Delay is only there in most cases to slow the movement so we can see it, a delay of 20ms is 1/50th sec and corresponds to about 50 frames per second (fps).

    The value for the delay can be a variable holding a number of ms, sometimes this can be useful to just delay upto a value, taking into account time spend actually doing the movement or associated calculations.

    While ("True")
      start = Clock.ElapsedMilliseconds 'time at start of time-step
      
      'Do all calculations and drawing movement here
      
      delay = 20 - (Clock.ElapsedMilliseconds-start) 'Time to delay accounting for time spent doing the work up to 20ms
      If (delay > 0) Then
        Program.Delay(delay)
      EndIf
    EndWhile


    Sunday, January 22, 2012 4:38 PM
    Moderator
  • Many thanks

    litdev

    As always you come in my help


    carlosfmur - Buenos Aires
    Sunday, January 22, 2012 8:32 PM