Re: Flashing a sprite

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



How do i calculate gametime tho? (sorry if i am being dense) Timing has
always been a struggle for me.

Am i right in this theory....

On app start, start the stopwatch.

Then take the time when i first showed my arrow and store that as starttime

then take the time the next frame comes round and take the difference so:

totalTime = StartTime - FrameTime;

Then do an if(totalTime > 500) dont render, reset the totalTime and wait
until the totalTime is 500 again and then show it again?

That sound right?



"ZMan" <zman@xxxxxxxxxxxxxx> wrote in message
news:uO8LWhVaGHA.4248@xxxxxxxxxxxxxxxxxxxxxxx
Maxamor is correct. For both #1 and #2 you should not base anything on
frametime (unless you can atarget specific hardware and lock the
framerate).

Use the stopwatch class in system.diagnostics to give you a time in
seconds

Then do something like

if (gametime % 2.0 == 0)
show sprite



--
Zman
http://www.thezbuffer.com - News and information for Managed DirectX



"Maxamor" <Maxamor@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2BF85B17-1FA8-4D6E-B1E6-A8D5427D7F9A@xxxxxxxxxxxxxxxx
As far as animation goes, I recommend not making it based off of "x
amount of
frames display frame 0, x amount of frames display frame 1" etc...

The reason behind this is that each frame may not be the same amount of
time
depending on which computer your program is running on. This means the
animation may look great on your pc, but if it runs faster on someone
else's
the animation would go faster too, possibly too fast.

Make the animation time-based.

That way, each frame can have an amount of time that it displays itself
before it lets the next frame be drawn.

Then, you could just make a 2-frame animation for your flashing sprite.
One
is completely invisible, and the other is completely visible and have
them
both display for 500ms or something. Then all you have to do is loop the
animation.

"Daniel" wrote:

Hi

Any one now a good tutorial or can help me onhow to make a flashing
sprite.
I want to make a flashing arrow.

I have some ideas:

1) lower and increase the alpha levels per frame
2) have it non rendered and then rendered after x many frames..

My problem is for option 2...and 1 for that matter, how do i get it to
flash
at a pace i want?

Is this kind of solution mental? To make a class for the flashing sprite
that i call say SpriteFlasher.

Then in that class have a var for how many frames to allow to pass until
showing the sprite, and another var for howmany frames it should remain
visible for.

Then i could create an instance and pass in the frames passed on every
loop?







.



Relevant Pages

  • Re: cant figure out a homework.. any help would help
    ... We have given you two Java classes, Animation and Sprite, which you ... Create an Animation object and set the image ... Do this with the first frame of your bouncing ball. ...
    (comp.lang.java.help)
  • Re: cant figure out a homework.. any help would help
    ... We have given you two Java classes, Animation and Sprite, which you ... Create an Animation object and set the image ... Do this with the first frame of your bouncing ball. ...
    (comp.lang.java.help)
  • Re: Fast screen access - idea
    ... Say, during a single frame, I am plotting 10 ... I define a small rectangle graphics window that ... and the Iyonix's NVidea to send over the sprite data ...
    (comp.sys.acorn.programmer)
  • Re: Flashing a sprite
    ... you've reached the end of the animation, in which case frameIndex would go ... I guess the 2 would be my amount of seconds....but after gametime ... frames display frame 0, x amount of frames display frame 1" etc... ... you could just make a 2-frame animation for your flashing sprite. ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Flashing a sprite
    ... frametime= stopwatch.currentvalue ... RenderGameObjects ... then take the time the next frame comes round and take the difference so: ... you could just make a 2-frame animation for your flashing sprite. ...
    (microsoft.public.win32.programmer.directx.managed)