Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Help with AMOS Pacman from CU magazine  (Read 3048 times)

0 Members and 1 Guest are viewing this topic.

squall457

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 2
Help with AMOS Pacman from CU magazine
« on: July 05, 2008, 08:54:28 AM »

Hey all, just dug out my amiga again last week and found my amos pro disk that I fancied having a crack at.

I was trying the pacman articles from CU magazine (can give link if required), I'm sure many of you are familiar with it.

The thing that is bugging me is the autoback feature with double buffering. The magazine says it is set to 0, because we will deal with screen flipping and bob updating ourselves. This is all fine and dandy, accept in true mag-style they never did include any more information on how to deal with it.

So I know I need to have commands like Screen Swap, Wait Vbl, Bob draw etc.. I just can't work out where to put them. There's none in any of the code the mag gives. The problem is when I change a tile pacman has eaten to a blank one. It just flashes! I know this is because I've change a screen while it was updating and so they don't match. At the moment I've changed the autoback to 2, but now gameplay significantly slows down when pacman is eating tiles, and I'd rather crack this screen swapping.

After reading the AMOS documentation, I know why it's flashing, I just don't know how to deal with it. The closest I've come is having my main game loop as

Do
_MOVEPACMAN
Wait Vbl
Screen Swap
Loop

But this causes the pacman bob to disappear, but you can move 'invisible' pacman around and watch the tiles disappear!



Could anyone shed some light please?
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Help with AMOS Pacman from CU magazine
« Reply #1 on: July 05, 2008, 01:09:59 PM »

In order to the the flashing to stop put this at the beginning of your program:

Code: [Select]
flash off
and to get the PacMan to draw, try putting the following code before Wait Vbl:

Code: [Select]
Bob Draw
If you have any other questions, feel free to post them here.   :)
Logged

squall457

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 2
Re: Help with AMOS Pacman from CU magazine
« Reply #2 on: July 05, 2008, 02:31:02 PM »

Thanks

I did already have flash off, but now with this:

Do
_MOVEPACMAN
Bob Draw
Screen Swap
Wait Vbl
Loop

(or even with bob draw and screen swap other way round), the game is smooth and the tiles do not flicker, however the tiles that pacman leaves leave a flow of yellow behind him). So I figured I need a Bob Clear before move pacman.

This works well, however, every so often the screen changes back to something previous (the eaten pills reappear and there is a static image of pacman, for example, but it's quite random.. sometimes it's a flash, sometimes it sticks.he controllable pacman flickers when in the top three rows... this didn't happen before!), so I'm guessing this is something to do with the screens being slightly out of sync, and when one gets so far behind that when it shows on screen. Trouble is I can't find where to add another wait vbl without it screwing it up even more!

« Last Edit: July 05, 2008, 02:48:06 PM by squall457 »
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Help with AMOS Pacman from CU magazine
« Reply #3 on: July 05, 2008, 08:01:52 PM »


You don't want another wait vbl. It's purely used to ensure that the screen is updated before the copper get's a chance to draw it - otherwise you can get corrupted screens... though this seems to be happening anyway. Including more Vbl's will slow things down.

I have never used the double buffer commands as I have never been happy with using them. That's not to say they can't be used, it's just that they have to be placed in the right places with the right settings to work properly.


Regards,
Lonewolf10

Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Help with AMOS Pacman from CU magazine
« Reply #4 on: July 06, 2008, 05:03:27 PM »

Thanks

I did already have flash off, but now with this:

Do
_MOVEPACMAN
Bob Draw
Screen Swap
Wait Vbl
Loop

(or even with bob draw and screen swap other way round), the game is smooth and the tiles do not flicker, however the tiles that pacman leaves leave a flow of yellow behind him). So I figured I need a Bob Clear before move pacman.

This works well, however, every so often the screen changes back to something previous (the eaten pills reappear and there is a static image of pacman, for example, but it's quite random.. sometimes it's a flash, sometimes it sticks.he controllable pacman flickers when in the top three rows... this didn't happen before!), so I'm guessing this is something to do with the screens being slightly out of sync, and when one gets so far behind that when it shows on screen. Trouble is I can't find where to add another wait vbl without it screwing it up even more!


You want the Screen Swap command right AFTER the Wait Vbl and the Bob Clear before the call to _MOVEPACMAN.  The Wait Vbl is used to make the Screen Swap sychronized with the vertical blanking interrupt on the graphics chips.  That interrupt takes place between screen updates so that the Screen Swap command will be invisible to the user.

Also, if you need to know what the commands do, just move the cursor over the command you are using and press the Help button on the keyboard.  Online help will appear.  If you want to see multiples of the online help screens at once, point your internet browser to http://www.amigacoding.com/index.php/AMOSi:Main_Menu and use tabs to switch between them on your browser.
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022