View Single Post
Old 01 March 2018, 13:32   #4
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
Welcome along! I haven't run your code but have had a quick read through it. First thoughts:

- The display library is more versatile than the slices library so I would recommend reading about that and using it instead.
- Generally it looks pretty good! The layout and comments give away the fact you've coded before

Now, to answer some questions:
- Yes, the Pop command is exactly what you're looking for, though it's not considered particularly great programming technique (from the same school as Goto and Gosub), so it would be preferable to work around it if possible. If needed though, Pop can get you out of any loop (For, While or Repeat), a Gosub, an If, or a Select (the Blitz equivalent of Switch).

- Yes, the procedure must be in your code before it is called for the first time. This is a limitation of the compiler, but in practice makes very little difference and shouldn't cause you any problems. Basically they're just all put at the top of your code and you're sorted. They're still called Procedures in Blitz in general, but are also called Statements and Functions, based on whether they give a return value or not.

- Without having run it, I'm not sure what the issue is with the character rendering. Does it flicker without the VWait 4? It sounds like it's just too slow to blit in a single frame if that's the case. If it doesn't flicker, but just animates or renders too quickly, you just need to remember that everything in Amigaland is timed to a frame, so for smooth animation you need to have 50 (or 60) frames per second. Double buffering won't help this, it just fixes flickering that happens when the rendering isn't finished before the next frame is due.

The ways around this are typically:
- Simply frameskip (using VWait as you're doing, or using the other frames to do other processing)
- Run at 50FPS and add more animation frames
- Run at 50FPS and only change the current animation frame every nth frame (I think a lot of games use this method)
- A combination of above (e.g., run at 25FPS and update the animation frame every 2 frames for a total of 8 FPS of animation)
Daedalus is offline  
 
Page generated in 0.07458 seconds with 11 queries