• Axe Q&A 5 5
Currently:  

Author Topic: Axe Q&A  (Read 588430 times)

0 Members and 1 Guest are viewing this topic.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #1620 on: May 01, 2013, 03:36:08 am »
Axe includes data in programs in the same order you enter it. What this means is that if you enter the data for 19 sprites contiguously, they will end up in the compiled program in that same order with no gaps between their data. Knowing that each monochrome 8x8 sprite is 8 bytes large, each consecutive sprite must then be exactly 8 bytes in memory after the one before it. So you can access the Ith sprite (0-indexed) with I*8+Pic00.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Axe Q&A
« Reply #1621 on: May 01, 2013, 03:36:17 am »
A sprite is 8 bytes so you'd do :
For(I,0,18)
Pt-On(X,Y,I*8+Pic00)
Y+8->Y
.Wrap to the next column :
If Y>58
X+8->X
0->Y
End
End

Also note that you don't need to name all the sprites since they're continuous data.

Edit : Ninja'd by Runer, but I gave you the code. :P

And welcome to Omni ! Have some peanuts :
!peanuts
« Last Edit: May 01, 2013, 03:37:18 am by Streetwalker »

Offline rampadc

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 5
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #1622 on: May 01, 2013, 03:44:21 am »
Thank you Runner and thanks for the tip Walker!

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1623 on: May 01, 2013, 03:52:54 am »
Quick question, is there a way to loop through static variables? For example, I have 19 sprites Pic00, Pic01, Pic02,...,Pic18, and I'd like to display them horizontally across the screen (until it reaches the edge and go to the next column).

I've read somewhere that you can use
Code: [Select]
For(I,0,18)
Pt-On(X,Y,Pic00+I)
End

But all I got is the first sprite pressed down and spread across the screen (think of butter or shift drag in MSPaint).
You already got the answer, but I wanted to precise some things. I think that your problem comes from the fact you said "static variables".
First of all, what can a static variable be ? Is is static or variable ? :P
But most of all, your data is not to be treated as variables, static or not, but as bytes, pointed by pointers. This is why when you have a bunch of 8x8 sprites, the first one is pointed by some pointer P, and the second one is pointed by P+8 (as Runer and StreetWalker said), because it is 8 bytes after the beginning of the first sprite in your data.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline rampadc

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 5
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #1624 on: May 01, 2013, 07:28:57 am »
Noted. I need some help with displaying some sprites. I'm getting some pixels turned on. It's random. For each compilation pixels get turned on randomly.



Code: [Select]
.CONC

.Setup sprites
[FFFFFFFFFFFFFFFFFF81BD959D8581FFFF81A19DA1BD81FFFF81BDA5BDA181FFFF81BDBD858581FFFF8191BD919181FFFF81A199998581FFFF81BDBDBD9981FFFF81BDA5A59981FFFF81A599A5A581FFFF81BDBDBDA581FFFF81A5BDBDBD81FFFF818199998181FFFF8199A5A59981FFFF81BD9D8D8581FFFF81BDB9B1A181FFFF81858D9DBD81FFFF81A1B1B9BD81FFFF81BD99999981FF]->Pic0

DiagnosticOff
ClrHome

.DRAW
0->X:0->Y
For(I,0,35)
If X>88
0->X
Y+8->Y
End
Pt-On(X,Y,I*8+Pic0)
X+8->X
End
DispGraph

.LOOP TILL ENTER
Repeat getKey(9)

End
« Last Edit: May 01, 2013, 07:33:31 am by rampadc »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1625 on: May 01, 2013, 07:38:55 am »
Try replacing your ClrHome with a ClrDraw.
What ClrHome does is clearing the screen, while ClrDraw clears the main buffer, where all your drawings go, and which is copied to the screen with the DispGraph. So if you don't clear it at the beginning of your program, chances are that you are drawing to a buffer that is not empty.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Axe Q&A
« Reply #1626 on: May 01, 2013, 09:00:07 am »
Code: [Select]
[FFFFFFFFFFFFFFFFFF81BD959D8581FFFF81A19DA1BD81FFFF81BDA5BDA181FFFF81BDBD858581FFFF8191BD919181FFFF81A199998581FFFF81BDBDBD9981FFFF81BDA5A59981FFFF81A599A5A581FFFF81BDBDBDA581FFFF81A5BDBDBD81FFFF818199998181FFFF8199A5A59981FFFF81BD9D8D8581FFFF81BDB9B1A181FFFF81858D9DBD81FFFF81A1B1B9BD81FFFF81BD99999981FF]->Pic0
Ouch. You should do that :
Code: [Select]
[sprite1]->Pic0
[sprite2]
...
[sprite18]
That'd be much more readable and easier to edit. ;)

Offline rampadc

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 5
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #1627 on: May 01, 2013, 09:31:04 am »
I've tried ClrDraw and ClrDrawrr both didn't work.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: Axe Q&A
« Reply #1628 on: May 01, 2013, 09:59:05 am »
you have 18 spirites, no ?

If yes, then change the 35 in the for() to 17

I think pxl random appears because you draw undefined spirites
« Last Edit: May 01, 2013, 10:00:22 am by TheMachine02 »
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline rampadc

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 5
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #1629 on: May 01, 2013, 10:53:47 am »
Thanks. I'm not sure why I put 35 there.

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Axe Q&A
« Reply #1630 on: May 01, 2013, 10:59:52 am »
Quick question, is there a way to loop through static variables? For example, I have 19 sprites Pic00, Pic01, Pic02,...,Pic18, and I'd like to display them horizontally across the screen (until it reaches the edge and go to the next column).

Code: [Select]
For(I,0,11)
Pt-On(I*8,0,I*8+Pic00)
End
In-progress: Graviter (...)

Offline Joshuasm32

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 142
  • Rating: +19/-7
    • View Profile
    • Network
Re: Axe Q&A
« Reply #1631 on: May 01, 2013, 05:17:12 pm »
I would like to learn Axe...  However, I can't find a complete tutorial and every program that I try to make throws an error while compiling.   :w00t:  Can anybody help, PLEASE?
« Last Edit: May 01, 2013, 05:17:48 pm by codebender »
My name is Josh and I a developer at Moonzean. I enjoy Radiohead, web development, Java, and cryptograms.
Spoiler For No Surprises, by Radiohead:
A heart that's full up like a landfill
A job that slowly kills you
Bruises that won't heal

You look so tired unhappy
Bring down the government
They don't, they don't speak for us

I'll take a quiet life
A handshake of carbon monoxide

And no alarms and no surprises
No alarms and no surprises
No alarms and no surprises
Silent, silent

This is my final fit
My final bellyache

With no alarms and no surprises
No alarms and no surprises
No alarms and no surprises please

Such a pretty house
And such a pretty garden

No alarms and no surprises
No alarms and no surprises
No alarms and no surprises please

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #1632 on: May 01, 2013, 05:21:44 pm »
I would advise fully reading through the Documentation.pdf file included in Axe releases, for starters. It's far from a total guidebook, but it covers a lot of the basics and walks through code examples for common tasks.

Offline Joshuasm32

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 142
  • Rating: +19/-7
    • View Profile
    • Network
Re: Axe Q&A
« Reply #1633 on: May 01, 2013, 05:23:46 pm »
Thank you!   ;D
My name is Josh and I a developer at Moonzean. I enjoy Radiohead, web development, Java, and cryptograms.
Spoiler For No Surprises, by Radiohead:
A heart that's full up like a landfill
A job that slowly kills you
Bruises that won't heal

You look so tired unhappy
Bring down the government
They don't, they don't speak for us

I'll take a quiet life
A handshake of carbon monoxide

And no alarms and no surprises
No alarms and no surprises
No alarms and no surprises
Silent, silent

This is my final fit
My final bellyache

With no alarms and no surprises
No alarms and no surprises
No alarms and no surprises please

Such a pretty house
And such a pretty garden

No alarms and no surprises
No alarms and no surprises
No alarms and no surprises please

Offline TheBassetHound

  • LV2 Member (Next: 40)
  • **
  • Posts: 36
  • Rating: +7/-3
  • GLaDOS is a potato
    • View Profile
Re: Axe Q&A
« Reply #1634 on: May 06, 2013, 10:12:32 pm »
N00B QUESTION ALERT:
read with cation as this may cause serious to fatal n00bism.

What is axe???? I'd like to learn...

(p.s. How do you get spoilers in replies?)
:w00t:
TheBassetHound


Aperture Science Handheld Portal Device
 /––––\    (¯\       /¯—/¯¯–______––
/   /\/˜¯¯¯\  \____/     \
   /          \___________\
 –(           |____________\
   \   /¯¯--•¦=––––––––––––\
    \/           ¯\==========\
\     ¯¯——__–¯\—————––\
 \––––___–¯–¦__                   \ √=_
                   \____——¯¯¯¯¯¯¯¯