Results 1 to 2 of 2
  1. #1
    Amiga PT user VIP
    My location

    Tiago's Avatar
    Join Date
    Aug 2007
    Location
    Estoril/Lisbon
    Posts
    2,389
    Downloads
    0
    Uploads
    0

    using Sprites to display graphics

    some time ago, i did my first boing ball in C language, using basic draw commands.
    i made it in classic red and white, but the system take a lot of time to draw it and fill the color. And if i wanted to pu my ball to "walk from one point to other" i had to draw the full object then erase it all, then draw it again 1 pixel in other direction... this would do a flicker animation....
    Can i use sprites to speed up the process?
    What limitations do i have?
    If i understand correctly a sprite is a small range of pixels that you can put "walking" thru screen using direct hardware.... is that correct? but if i want to use an area bigger then the sprite?

    imagine a simple square on screen, with basic commands (no sprites) i can do:

    1) draw 4 lines connecting each other
    or
    2) draw each pixel from one coordenate to other

    then to put it going to one side of screen to other, i would have to draw, erase, draw again, erase again....and so one... this will flicker the screen a lot... it works but it is not the best way....


    How can i do it with sprites? Must i draw the object inside the sprite area and then i can tell the sprite to "walk" around the screen? But about transparency? if i have a background?
    A500 - A600 - A1200 - A4000 - CDTV
    www.revistapushstart.com

  2. #2
    Retro Addict Administrator
    My location

    Burger Time Champion, Sonic Champion Harrison's Avatar
    Join Date
    Dec 2002
    Location
    UK
    Posts
    15,592
    Blog Entries
    1
    Downloads
    6
    Uploads
    14
    Think of a sprite as a 2D graphical bitmap image. The closest thing to explain it easily is to think of a spite like a GIF image. It doesn't need to be drawn by the CPU or graphics hardware in the same way as you have been trying to do in code. Instead it is a set sized image that is held in memory and can be manipulated, moved, scaled etc.

    I would recommend you have a play around using AMOS to get a good understanding of sprites and how you can use them. While AMOS isn't the greatest basic programming language it does have a lot of direct support for sprites and the manipulation of them.

    There are hardware limitations with sprites. All hardware has a maximum size it can handle to easily move and work with sprites. Coders get around this problem by building larger graphics using multiple sprites on screen and just moving the position of the sprites relative to each other when you want to move them around the screen.

    You can also work with transparency within a sprite using something similar to a transparent colour in a gif file, or an alpha channel that removes pixels from the sprite that are a specific pixel colour.

    Vector graphics in contrast are completely different. All that exists is the instructions explaining where the start and end points of a vector are on the screen and these end point co-ordinates can be changed to move the vector around the screen. A very different process, and it creates a completely different result.

    If you haven't played a classic game in years, it's never too late to start!


Similar Threads

  1. PSP with PSOne graphics
    By Demon Cleaner in forum Handheld Gaming
    Replies: 3
    Last Post: 6th February 2009, 11:17
  2. Amiga RTG graphics cards
    By Harrison in forum Hardware
    Replies: 3
    Last Post: 23rd September 2008, 13:06
  3. Good display option for Amiga users
    By Harrison in forum Hardware
    Replies: 8
    Last Post: 9th July 2008, 10:57
  4. Budget AGP graphics cards
    By Harrison in forum PC - Windows, Linux, Mac
    Replies: 7
    Last Post: 6th March 2008, 18:31
  5. Do you own an Amiga graphics card?
    By Harrison in forum Hardware
    Replies: 6
    Last Post: 6th November 2007, 19:41

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright classicamiga.com