Author Topic: EXA: Scale up sprites  (Read 3369 times)

0 Members and 1 Guest are viewing this topic.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
EXA: Scale up sprites
« on: January 31, 2012, 05:06:46 am »
Have you ever wanted to scale up a sprite? Use this AXE subroutine:
Code: [Select]
Lbl SPR
For(A,0,7
{r5+A}->r6
For(B,0,7
If r6^2
Rect(B*r3+r1,A*r4+r2,r3,r4
End
r6/2->r6
End
End
Now use this code to call the subroutine:
Code: [Select]
SPR(x,y,w,h,pic
It uses rectangles of size w,h to display the sprite. I guess this code can be optimized, but it does the job.

For example:
Code: [Select]
.SPRITESC
[3C42A581A599423C]->Pic1
ClrDraw
For(A,2,10
SPR(5,5,C,C/2,Pic1
Pause 300
DispGraphClrDraw
End
Pause 1000
Return
Lbl SPR
For(A,0,7
{r5+A}->r6
For(B,0,7
If r6^2
Rect(B*r3+r1,A*r4+r2,r3,r4
End
r6/2->r6
End
End

I hope you find this information helpful. Please leave suggestions and or questions.
« Last Edit: January 31, 2012, 05:07:16 am by Keoni29 »
If you like my work: why not give me an internet?








Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: EXA: Scale up sprites
« Reply #1 on: February 15, 2012, 07:11:29 am »
I suppose that's like Pt-Off() command, you can't draw white pixels ?

Why you didn't use BYTEeBIT command ?
Code: [Select]
Lbl SPR
For(A,0,7
{r5+A}->r6
For(B,0,7
If r6eB
Rect(B*r3+r1,A*r4+r2,r3,r4
End
End
End

e = exp token.
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

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: EXA: Scale up sprites
« Reply #2 on: February 16, 2012, 12:18:16 am »
How fast does this runs by the way? I'm curious if it could be used in-game. I made a scaling routine for 8x8 sprites back then, which, however, used 8x8 plain white or black squares and thus, the bottom and right were weird if I remember. It ran at around 10 fps. Not really useable in a real-time animation, but one person could simply pre-render each instance of zoomed up sprite prior the main game loop then temporarily store them into a buffer and displayed when needed.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: EXA: Scale up sprites
« Reply #3 on: February 17, 2012, 04:13:45 am »
How fast does this runs by the way? I'm curious if it could be used in-game. I made a scaling routine for 8x8 sprites back then, which, however, used 8x8 plain white or black squares and thus, the bottom and right were weird if I remember. It ran at around 10 fps. Not really useable in a real-time animation, but one person could simply pre-render each instance of zoomed up sprite prior the main game loop then temporarily store them into a buffer and displayed when needed.
I will try to render it 1000 times and see how long it takes.
If you like my work: why not give me an internet?








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: EXA: Scale up sprites
« Reply #4 on: February 17, 2012, 09:32:27 am »
Ok here was my routine. From what I remember now, I think I actually drew an extra row of white squares below. It was definitively not very reliable, due to erasing stuff below.

http://ourl.ca/6016/93657


Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: EXA: Scale up sprites
« Reply #5 on: February 17, 2012, 11:03:00 am »
My routine is much quicker since it doesn't scale partially.
If you like my work: why not give me an internet?