Author Topic: Sprite Editor  (Read 24096 times)

0 Members and 1 Guest are viewing this topic.

Offline Michael.3545

  • LV3 Member (Next: 100)
  • ***
  • Posts: 69
  • Rating: +13/-7
    • View Profile
Re: Sprite Editor
« Reply #45 on: June 25, 2010, 10:16:19 pm »
I have no idea how I missed that.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Sprite Editor
« Reply #46 on: June 25, 2010, 10:49:03 pm »
Yeah, I'm the only one working on this project, though others help find bugs/suggest features. And yeah, there's only one "N" in my name. :P

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Sprite Editor
« Reply #47 on: July 02, 2010, 12:35:15 pm »
runer, i'm not sure how you invert sprites but i have a suggestion, if you don't do this already. pretend your sprite data is in L1.
Code: [Select]
For(A,0,7
255-{L1+A}->{L1+A}
End

this "inverts" your sprite data, one byte at a time. thought i would share, just in case.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Sprite Editor
« Reply #48 on: July 02, 2010, 12:49:17 pm »
Nemo, that's some really cool code!  Nice job! ;D

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Sprite Editor
« Reply #49 on: July 02, 2010, 05:24:43 pm »
mhmm interesting trick, I guess it could also be useful for other stuff as well :)
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Sprite Editor
« Reply #50 on: July 03, 2010, 12:45:21 am »
i use it in my tilemapper program. imaginary points to anyone who figures out how to modify that routine to make it invert sprites smaller than 8x8 (: anyway, i can't really think of any use besides inverting sprites/tiles, though. i just posted it in case runer was using two for loops with a pxl-change.


Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Sprite Editor
« Reply #51 on: July 03, 2010, 12:50:34 am »
Actually I was looping through bytes and inverting them, although I was using {pointer} xor 255→{pointer}. I forgot 255 xor X=255-X, but I'll use the subtraction because it's smaller and probably faster.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Sprite Editor
« Reply #52 on: July 03, 2010, 12:54:32 am »
if your sprite data is in L1 and your X width is in X (less than or equal to 8) and your Y width is in Y (less than or equal to 8)

Code: [Select]
255/(9-X)->A
For(F,0,Y-1
A xor {L1+F}->{L1+F}
End

Hypothetical but it should work :D

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Sprite Editor
« Reply #53 on: July 03, 2010, 01:01:50 am »
builderboy: doesn't work. i tried to invert a blank 4x4 tile and got  3333333300000000 as my hex code. you can't just divide 255 by a number, you need to subtract from it. a 7x7 sprite needs to subtract uses 254, since each byte is a row in the sprite, to subtract 1 pixel (or 1 bit) you would subtract just 1. if you needed to subtract two bits to get a 6x6 sprite, you would subtract 3.


Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Sprite Editor
« Reply #54 on: July 03, 2010, 01:05:02 am »
What about e^(X)-1->A  That should work with X between 0-8
« Last Edit: July 03, 2010, 01:07:32 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Sprite Editor
« Reply #55 on: July 03, 2010, 01:10:42 am »
i don't think so. here's a table.

sprite size      :      number to subtract from
8                         255
7                         254
6                         252
5                         248
4                         240



Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Sprite Editor
« Reply #56 on: July 03, 2010, 01:12:06 am »
Oh silly me i mixed up exponentiation and multiplication ;D And thats a better way than using a for loop Quigibo!  I didnt know powers of 2 had been implemented :)

And Nemo i believe Quigibo is doing the xor method. Unless its the same?

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Sprite Editor
« Reply #57 on: July 03, 2010, 01:15:48 am »
they're the same, i think.
here:
Code: [Select]
For(A,0,S-1
256-e^(8-S)-{L1+A}->{L1+A}
End

S being the size 1-8.

edit: 200 posts (:
« Last Edit: July 03, 2010, 04:13:36 pm by nemo »