Author Topic: 16*16 Images  (Read 5463 times)

0 Members and 1 Guest are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
16*16 Images
« on: November 21, 2010, 03:13:43 pm »
Hey, I was trying to implement an image in my programs, a 16*16 image, this is the code:

Code: [Select]
00000000000000000000000003F80404080410027FFF8001FFFF781E4812300C
So I would have:

Code: [Select]
Lbl 1
[00000000000000000000000003F80404080410027FFF8001FFFF781E4812300C->Pic1
Pt-Change(0,0,Pic1
DispGraph
Repeat getKey->Z
If Z>=1
Goto1

However, nothing appears, is it a temporary problem or it works for you?

I gotta try it in WabbitEmu but I can't now :S


Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: 16*16 Images
« Reply #1 on: November 21, 2010, 03:17:50 pm »
Pt-Change takes a pointer to an 8-byte sprite. a 16x16 image is 32 bytes. you'll need to do this:

Code: [Select]
Lbl 1
[00000000000000000000000003F80404080410027FFF8001FFFF781E4812300C->Pic1
Pt-Change(0,0,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,8,Pic1+24
DispGraph
Repeat getKey->Z
If Z>=1
Goto1


Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: 16*16 Images
« Reply #2 on: November 21, 2010, 03:18:28 pm »
Code: [Select]
Pt-Change(0,0,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,8,Pic1+24

Wuuuh thanks much! Like your reply ;)

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: 16*16 Images
« Reply #3 on: November 21, 2010, 04:01:25 pm »
Code: [Select]
Pt-Change(0,0,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,8,Pic1+24

Wuuuh thanks much! Like your reply ;)


Optimization ;)

Code: [Select]
Pt-Change(0,,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,,Pic1+24
« Last Edit: November 21, 2010, 04:06:45 pm by Runer112 »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: 16*16 Images
« Reply #4 on: November 21, 2010, 04:05:04 pm »
Code: [Select]
Pt-Change(0,0,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,8,Pic1+24

Didn't work :S

Code: [Select]
Pt-Change(0,,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,,Pic1+24

Nice optimization, gotta try it too :)

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: 16*16 Images
« Reply #5 on: November 21, 2010, 04:07:34 pm »
Also, I'm a little confused as to what you intended your getKey code section to do. The Repeat doesn't have a matching End, and it doesn't make sense to have code to check a getKey value inside of a loop that will end whenever you press a key.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: 16*16 Images
« Reply #6 on: November 21, 2010, 04:08:42 pm »
Also, I'm a little confused as to what you intended your getKey code section to do. The Repeat doesn't have a matching End, and it doesn't make sense to have code to check a getKey value inside of a loop that will end whenever you press a key.

What doesn't work is the image :S It is all confused and crazy :s


And I'm using Pause 9999

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: 16*16 Images
« Reply #7 on: November 21, 2010, 04:13:09 pm »
That's because your image is a 16x16 sprite. What you need to do is split it into four 8x8 sprites, and it should work.
« Last Edit: November 21, 2010, 04:52:56 pm by Deep Thought »




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: 16*16 Images
« Reply #8 on: November 21, 2010, 04:19:09 pm »
And I'm using Pause 9999

Just a note, there's no reason to stop at 4 digits. You know you can pause for values up to 65535 (actually up to 65536, which is what 0 does)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: 16*16 Images
« Reply #9 on: November 21, 2010, 04:22:33 pm »
For odd reasons, I think he ended up taking a habit from BASIC programming. ;D. In BASIC, it's typical to do Repeat Z=number:Getkey->Z:End in non-realtime games, because otherwise, at 2-3 FPS, key detection is terrible.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: 16*16 Images
« Reply #10 on: November 21, 2010, 06:40:43 pm »
Sorry, had to go earlier, but what I meant by

That's because your image is a 16x16 sprite. What you need to do is split it into four 8x8 sprites, and it should work.

is this: Say you have a picture like this:

■■■■■■■■■■■■■■■■
■■▢▢▢▢▢▢▢▢▢▢▢▢■■
■▢■▢▢▢▢▢▢▢▢▢▢■▢■
■▢▢■▢▢▢▢▢▢▢▢■▢▢■
■▢▢▢■▢▢▢▢▢▢■▢▢▢■
■▢▢▢▢■▢▢▢▢■▢▢▢▢■
■▢▢▢▢▢■▢▢■▢▢▢▢▢■
■▢▢▢▢▢▢■■▢▢▢▢▢▢■
■▢▢▢▢▢▢■■▢▢▢▢▢▢■
■▢▢▢▢▢■▢▢■▢▢▢▢▢■
■▢▢▢▢■▢▢▢▢■▢▢▢▢■
■▢▢▢■▢▢▢▢▢▢■▢▢▢■
■▢▢■▢▢▢▢▢▢▢▢■▢▢■
■▢■▢▢▢▢▢▢▢▢▢▢■▢■
■■▢▢▢▢▢▢▢▢▢▢▢▢■■
■■■■■■■■■■■■■■■■


Instead of storing it as a 16x16 picture, as in

Code: (Axe) [Select]
:[FFFFC003A0059009881184218241818181818241842188119009A005C003FFFF]→Pic1

you should think of it as four 8x8 pictures:

■■■■■■■■   ■■■■■■■■
■■▢▢▢▢▢▢   ▢▢▢▢▢▢■■
■▢■▢▢▢▢▢   ▢▢▢▢▢■▢■
■▢▢■▢▢▢▢   ▢▢▢▢■▢▢■
■▢▢▢■▢▢▢   ▢▢▢■▢▢▢■
■▢▢▢▢■▢▢   ▢▢■▢▢▢▢■
■▢▢▢▢▢■▢   ▢■▢▢▢▢▢■
■▢▢▢▢▢▢■   ■▢▢▢▢▢▢■

■▢▢▢▢▢▢■   ■▢▢▢▢▢▢■
■▢▢▢▢▢■▢   ▢■▢▢▢▢▢■
■▢▢▢▢■▢▢   ▢▢■▢▢▢▢■
■▢▢▢■▢▢▢   ▢▢▢■▢▢▢■
■▢▢■▢▢▢▢   ▢▢▢▢■▢▢■
■▢■▢▢▢▢▢   ▢▢▢▢▢■▢■
■■▢▢▢▢▢▢   ▢▢▢▢▢▢■■
■■■■■■■■   ■■■■■■■■


Then you'd store each 8x8 chunk one by one, starting with the top left, then top right, then bottom left and right. So you'd store it as

Code: (Axe) [Select]
:[FFC0A09088848281]→Pic1
:[FF03050911214181]
:[8182848890A0C0FF]
:[81412111090503FF]

which is basically the four 8x8 sprites one after another, and it should work.
« Last Edit: November 21, 2010, 06:42:08 pm by Deep Thought »




Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: 16*16 Images
« Reply #11 on: November 22, 2010, 08:35:59 am »
Sorry, had to go earlier, but what I meant by

That's because your image is a 16x16 sprite. What you need to do is split it into four 8x8 sprites, and it should work.

is this: Say you have a picture like this:

■■■■■■■■■■■■■■■■
■■▢▢▢▢▢▢▢▢▢▢▢▢■■
■▢■▢▢▢▢▢▢▢▢▢▢■▢■
■▢▢■▢▢▢▢▢▢▢▢■▢▢■
■▢▢▢■▢▢▢▢▢▢■▢▢▢■
■▢▢▢▢■▢▢▢▢■▢▢▢▢■
■▢▢▢▢▢■▢▢■▢▢▢▢▢■
■▢▢▢▢▢▢■■▢▢▢▢▢▢■
■▢▢▢▢▢▢■■▢▢▢▢▢▢■
■▢▢▢▢▢■▢▢■▢▢▢▢▢■
■▢▢▢▢■▢▢▢▢■▢▢▢▢■
■▢▢▢■▢▢▢▢▢▢■▢▢▢■
■▢▢■▢▢▢▢▢▢▢▢■▢▢■
■▢■▢▢▢▢▢▢▢▢▢▢■▢■
■■▢▢▢▢▢▢▢▢▢▢▢▢■■
■■■■■■■■■■■■■■■■


Instead of storing it as a 16x16 picture, as in

Code: (Axe) [Select]
:[FFFFC003A0059009881184218241818181818241842188119009A005C003FFFF]→Pic1

you should think of it as four 8x8 pictures:

■■■■■■■■   ■■■■■■■■
■■▢▢▢▢▢▢   ▢▢▢▢▢▢■■
■▢■▢▢▢▢▢   ▢▢▢▢▢■▢■
■▢▢■▢▢▢▢   ▢▢▢▢■▢▢■
■▢▢▢■▢▢▢   ▢▢▢■▢▢▢■
■▢▢▢▢■▢▢   ▢▢■▢▢▢▢■
■▢▢▢▢▢■▢   ▢■▢▢▢▢▢■
■▢▢▢▢▢▢■   ■▢▢▢▢▢▢■

■▢▢▢▢▢▢■   ■▢▢▢▢▢▢■
■▢▢▢▢▢■▢   ▢■▢▢▢▢▢■
■▢▢▢▢■▢▢   ▢▢■▢▢▢▢■
■▢▢▢■▢▢▢   ▢▢▢■▢▢▢■
■▢▢■▢▢▢▢   ▢▢▢▢■▢▢■
■▢■▢▢▢▢▢   ▢▢▢▢▢■▢■
■■▢▢▢▢▢▢   ▢▢▢▢▢▢■■
■■■■■■■■   ■■■■■■■■


Then you'd store each 8x8 chunk one by one, starting with the top left, then top right, then bottom left and right. So you'd store it as

Code: (Axe) [Select]
:[FFC0A09088848281]→Pic1
:[FF03050911214181]
:[8182848890A0C0FF]
:[81412111090503FF]

which is basically the four 8x8 sprites one after another, and it should work.

Ooooh thanks, then I gotta split my image, it won't be hard using tokens :)