Ultimate Amiga

Please login or register.

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

Author Topic: Suggestion of using bitmap  (Read 2823 times)

0 Members and 1 Guest are viewing this topic.

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Suggestion of using bitmap
« on: May 31, 2015, 06:53:14 AM »

A person in IRC channel suggested instead of using an array which is 4 bytes use bitmap which is 1 bit and I can get the color(x,y) to detect collision and so on and I can have lots of layers using colors instead of array.

Can I do that in AMOS? If yes, how does that work exactly? What modification I need to do on my source code for that?
Logged

Hungry Horace

  • Amorphous Blue-Blob Man
  • Site Admin
  • A4000T
  • ******
  • Karma: 307
  • Offline Offline
  • Gender: Male
  • Posts: 3,364
  • Don't forget... Ameboid's need love too!
    • AUW
Re: Suggestion of using bitmap
« Reply #1 on: May 31, 2015, 08:56:00 AM »

Because I haven't seen the source, I can't answer that!!
There are certainly commands to check the colour of a single point through
Logged
Quote from: KillerGorilla
because winuae is made of code and your amiga is made of stuff

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Suggestion of using bitmap
« Reply #2 on: May 31, 2015, 03:43:54 PM »

A person in IRC channel suggested instead of using an array which is 4 bytes use bitmap which is 1 bit and I can get the color(x,y) to detect collision and so on and I can have lots of layers using colors instead of array.

Can I do that in AMOS? If yes, how does that work exactly? What modification I need to do on my source code for that?

Yes you could do it like that, but you would be restricted in the number of values you could use. For example, for a 16 colour (4 bitplane) screen you could only use values 0 to 15 for each location. Set the values by using Plot X,Y,COLOUR for each individual pixel. There are also instructions for drawing lines too, which will be much quicker for drawing wall locations ;)
Use PIXEL_COLOUR=Point(X,Y) to get the value of a particular pixel.

You don't to change a huge amount to your code. Just code a routine that converts your level data into an image (a nested FOR...NEXT loop should be sufficient), and alter your detection routine so that you check the pixel value on the hidden screen instead of the dimensioned array.
« Last Edit: May 31, 2015, 03:53:40 PM by Lonewolf10 »
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Suggestion of using bitmap
« Reply #3 on: June 08, 2015, 02:21:35 PM »

Keep in mind that the array is going to be in FastRAM while the bitmap is in Chip.  FastRAM is predictably faster than ChipRAM and the point command has to do a planar to chunky conversion so if speed is what you need, keep it in FastRAM.
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022