Author Topic: Displaying greyscale sprites  (Read 5706 times)

0 Members and 1 Guest are viewing this topic.

Offline Ki1o

  • LV3 Member (Next: 100)
  • ***
  • Posts: 95
  • Rating: +5/-2
  • Doing my best...
    • View Profile
Displaying greyscale sprites
« on: October 03, 2012, 08:39:31 pm »
I'm trying to see if I can display a sprite that has greyscale in it but I keep coming across a weird bug.  This is the code I have
.header
[Hex data] -> Pic1
[Hex data]
pt-on(15,20,Pic1)
repeat getkey(15)
Disphgraphr
end

The first hex is for the top buffer while the second is for the bottom.
When I run it, the sprite is displayed in monochrome while there is some greyscale "junk" along the top of the screen.
what am I doing wrong exactly?
Sorry for the bad post I am on my phone.
Co-developer of Quasar (formerly M4trix)
Axe programmer - lvl 2
Spoiler For Projects:
Rebirth: The Soul of Icarus (R:TSoI): (5%): Planning Stages
Vulcan's Labyrinth: (0%): Backstory Only

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Displaying greyscale sprites
« Reply #1 on: October 03, 2012, 09:26:48 pm »
you are doing several things "wrong"
firstly, you didn't clear the buffers before drawing to them. the front and back buffers are free ram areas that other things can and do use, so you need to clear them yourself with ClearDraw and ClearDraw^^r before drawing anything there or you will end up with the "junk" you mentioned.
secondly, all you are doing with that pt-on command is drawing to the front buffer. axe doesn't have a "draw to both front and back" command yet, although people have poked runer about it, so it may be added soon-ish. as of right now, you have to draw them separately, so that would mean drawing the first 8 bytes to the front buffer with pt-on(15,20,Pic1) and then the second 8 bytes in a sprite to the back buffer with pt-on(15,20,Pic1+8)^^r

Offline Ki1o

  • LV3 Member (Next: 100)
  • ***
  • Posts: 95
  • Rating: +5/-2
  • Doing my best...
    • View Profile
Re: Displaying greyscale sprites
« Reply #2 on: October 03, 2012, 09:58:48 pm »
I love you! That did the trick! Thanks you so much!  ;D :love:
Co-developer of Quasar (formerly M4trix)
Axe programmer - lvl 2
Spoiler For Projects:
Rebirth: The Soul of Icarus (R:TSoI): (5%): Planning Stages
Vulcan's Labyrinth: (0%): Backstory Only

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Displaying greyscale sprites
« Reply #3 on: October 03, 2012, 10:06:03 pm »
hehe, it wasn't anything big :P
any time you have questions don't hesitate to ask! axe can be a little tricky to work with at first.

Offline Ki1o

  • LV3 Member (Next: 100)
  • ***
  • Posts: 95
  • Rating: +5/-2
  • Doing my best...
    • View Profile
Re: Displaying greyscale sprites
« Reply #4 on: October 03, 2012, 10:38:52 pm »
Ok now how would I go about doing animation? Would it be *8 instead of plus or would I have to store the next frame to a different pointer?
Co-developer of Quasar (formerly M4trix)
Axe programmer - lvl 2
Spoiler For Projects:
Rebirth: The Soul of Icarus (R:TSoI): (5%): Planning Stages
Vulcan's Labyrinth: (0%): Backstory Only

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Displaying greyscale sprites
« Reply #5 on: October 03, 2012, 10:49:08 pm »
yeah, *8 is the best way to go about it.
if you wanted to loop through a list of 4 sprites, updating the buffer after displaying each one, then, you could do something like this:
for(L,0,3
pt-off(x,y,L*8+Pic1
DispGraph
End

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Displaying greyscale sprites
« Reply #6 on: October 04, 2012, 05:40:20 pm »
^Small correction, if he/she wants to do greyscale sprites, *16 should be used instead of *8.
In-progress: Graviter (...)

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Displaying greyscale sprites
« Reply #7 on: October 04, 2012, 07:49:23 pm »
not necessarily, as the front buffer and back buffer sprites could be stored in different places, or just stored with all the front buffer sprites together followed by all the back buffer sprites.
* shmibs was just giving a general case as well.

Offline Ki1o

  • LV3 Member (Next: 100)
  • ***
  • Posts: 95
  • Rating: +5/-2
  • Doing my best...
    • View Profile
Re: Displaying greyscale sprites
« Reply #8 on: October 05, 2012, 03:31:54 pm »
Ok what if its like an RPG sprite with two frames for each side would I place the for loop before or after the display command.
Co-developer of Quasar (formerly M4trix)
Axe programmer - lvl 2
Spoiler For Projects:
Rebirth: The Soul of Icarus (R:TSoI): (5%): Planning Stages
Vulcan's Labyrinth: (0%): Backstory Only

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Displaying greyscale sprites
« Reply #9 on: October 05, 2012, 04:46:45 pm »
Generally you should put the loop before the display command, although it really doesn't matter if it's in a while loop. Make sure you keep track of your order logic, however.
In-progress: Graviter (...)