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 7282 times)

0 Members and 4 Guests are viewing this topic.

Kaligon75

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 16
  • 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: 1
  • Offline Offline
  • Posts: 87
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: 23
  • 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
  • Gender: Male
  • Posts: 16
  • 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: 23
  • 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

Kaligon75

  • A600
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 16
  • Generic Amiga User
Re: Sprite and Bob
« Reply #5 on: January 30, 2018, 12:10:31 PM »

Ok I see it, nice game and very useful description. Now the problem is that when I use sprites in my projects with or without "get sprite palette" command the color palette never match with original colors while if I use bobs and "get bob palette" I get the correct color palette on the screen but bobs are pasted on screen and scroll with him, the sprites not. So, I need to open different screens for bobs, sprites, backgrounds, scores, etc ? It is correct ?
Logged

jimwon2016

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 23
  • Generic Amiga User
Re: Sprite and Bob
« Reply #6 on: January 30, 2018, 01:38:45 PM »

I would suggest you use the same 32 colour palette for everything, but make sure you only use colours 16-31 when drawing sprites. Think of it as a unifying factor across all your artwork.

The first thing I do when I start making graphics for a game is decide on the colours I will be using, I usually stick to 16 if I can and put my most used colours in the first 8.

This might seem like a huge restriction but there are a great many tricks you can do in pixel art to give the appearance of more colours... theres a great series on Youtube from the 8-bit guy that showcases these: https://www.youtube.com/watch?v=Tfh0ytz8S0k - a huge part of skill in 8/16 bit graphics is making the most of the restrictions.
Logged

adrazar

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 69
  • Generic Amiga User
Re: Sprite and Bob
« Reply #7 on: January 31, 2018, 11:34:05 PM »

but bobs are pasted on screen and scroll with him, the sprites not. So, I need to open different screens for bobs, sprites, backgrounds, scores, etc ? It is correct ?
The bobs and backgrounds are generally both in the same screen. Sprites are not contained in ANY screen, ever (they just sort of "float" on the display wherever you put them). This means that sprites are not automatically moved when you scroll a screen. To make it look like sprites scroll along with a background they must be moved manually.
« Last Edit: January 31, 2018, 11:40:21 PM by adrazar »
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022