Ultimate Amiga

Please login or register.

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

Author Topic: Sprite and Bob  (Read 245 times)

Kaligon75

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 10
  • Generic Amiga User
Sprite and Bob
« on: January 08, 2018, 12:32:18 PM »

Hi guys I have a problem with AmosPro. I wrote a routine for an horizontal scrolling game with an iff background and I put a ship to control with joystick and it works. If I change the Sprite command with the Bob command, the ship doesn't appear on the screen.
Logged

KevG

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 74
Re: Sprite and Bob
« Reply #1 on: January 08, 2018, 06:37:48 PM »

Hi there.

Sprites use hardware coordinates where as bobs use screen coordinates.

Regards Kev G
Logged

jimwon2016

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 18
  • Generic Amiga User
Re: Sprite and Bob
« Reply #2 on: January 09, 2018, 12:08:31 PM »

Hello,

If you are currently using bobs I suggest you stick with them, they are much easier to work with.

Here are some rules I follow when using Hardware Sprites. I have a game on AmiNET called Oubliette where you can see how the sprites look:

1 - Draw your sprite images on a 32 colour screen and make sure you only use colours 16-31 on your sprites. This is the only range of colours sprites can use and there are more rules if you want to have 3 colour sprites. I used the object grabber program in AMOS to create a sprite bank.

2 - At the start of your program, make sure you hide the mouse pointer and run command: Set Sprite Buffer 256. This increases the height of the hardware sprites used to make computed sprites to maximum.

3 - When opening a screen for sprites, run command: Get Sprite Palette. This makes sure you will use the right colours.

4 - For computed sprites, make sure your sprites are numbered in the range 8 - 62 and do not use odd numbered sprites. This is important because you have no control over which hardware sprites are used to generate computed ones and having odd numbered sprites can cause problems.

5 - When positioning a sprite onscreen use the following command: Sprite NUMBER,X Hard(X Co-Ord),Y Hard(Y Co-Ord),IMAGE. The functions X Hard() and Y Hard() are important because they convert the hardware co-ordinate of the sprite into a screen co-ordinate, otherwise the sprite will not display in the location you want it too.

Limitations of sprites mean that for every horizontal or vertical line on the screen display there can only be 64 pixels of sprite. If there are more pixels in a line then the sprite switches off. In a moving action game this appears as sprite flicker but in a static display they will not show up if aligned in a grid.

Hope this helps.
Logged

Kaligon75

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 10
  • Generic Amiga User
Re: Sprite and Bob
« Reply #3 on: January 10, 2018, 01:45:53 PM »

Thanks for your suggestions. Now i don't know how to shoot from the ship of player 1. I grabbed a part of code from another example program and put it in my game but there are some difference. I'm using Amal instructions to do this (movement and fire of player 1).
Logged

jimwon2016

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 18
  • Generic Amiga User
Re: Sprite and Bob
« Reply #4 on: January 22, 2018, 02:36:44 PM »

Sorry, I can't give you any advice on Amal. I have never managed to successfully use it because it operates at a different speed from the main program. I avoid it and move/animate everything myself.

Have a look here: http://aminet.net/package/game/actio/Oubliette to see how my game came out and you can read the full commented source code here: http://aminet.net/package/game/actio/Oubliette_src. No Amal was used in that game.
Logged
Pages: [1]   Go Up