|
|
"clipka" <nomail@nomail> wrote:
> "RC" <nomail@nomail> wrote:
> > I know this question is going to be a head slapper but I can't seem to get an
> > object to increase in speed. I need this object to increase in speed every x
> > clock cycles, so I'm using an if statement. Problem is I can get it to enter
> > the 'else' section, but it never returns to my original condition after I reset
> > my variable counting to x (num).
>
> Unless I got you wrong, the head slapper is probably the fact that animations
> aren't run in a loop as you seem to expect. Instead, the whole SDL is restarted
> for each frame, with different values for clock and frame number.
>
> To pass values from one frame to the next, you need to #write them to a file. Or
> re-compute everything from the frame number. For example, you could change your
> code to:
>
> #declare elapsedClock = 0;
> #while (elapsedClock < clock)
>
> //... re-compute what you did in those previous frames...
>
> #declare elapsedClock = elapsedClock + (clocksPerFrame)
> #end
Hmmm, I thought as long as my variables were functions of the clock it would
work. Isn't mine essentially the same? A conditional based on the clock that
changes every clock cycle? The issue I see, is that I need to be able to render
x number of times before changing the speed, but I can't find a way of counting
to x that can be reset back to the initial value. Bahh, am I missing something
fundamental?
Post a reply to this message
|
|