• Axe Q&A 5 5
Currently:  

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

0 Members and 6 Guests are viewing this topic.

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: Axe Q&A
« Reply #210 on: April 01, 2011, 09:52:34 am »
Here's the first tutorial ever published on the subject: http://ourl.ca/4129/114828
There may be more tucked around in places, but that was the real eye-opening one. :)

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #211 on: April 02, 2011, 02:41:59 am »
If you include a program in axe source, like ↓
Code: [Select]
:.PROGRAM
:[stuff]
:prgmPROGRAM2
:[more stuff]
Does Axe put a return after the sub-program, or do you have to put in the ret manually?
« Last Edit: April 02, 2011, 02:42:17 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

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: Axe Q&A
« Reply #212 on: April 02, 2011, 09:52:33 am »
Nope. It's included exactly as if the subprogram code were in the main program.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #213 on: April 18, 2011, 07:12:20 am »
I love multiple programs in Axe, I just tried them.

I have an Axe question:

Code: [Select]
.POP
prgmPOPSTUP
prgmGKSRC
If pxl-Test(X,Y+5)
Return
End
Pt-On(20,55,[FFFFFFFFFFFFFFFF
Pt-On(X,Y,[FF42241800000000
End

1. I know I can use a Rect( instead of the Pxl-On(20,55. Is it faster/smaller?
2. The sprite at X,Y is 4 pixels tall, so why won't pxl-Test(Y+5) execute? The program is never closed, that if is never checked.
3. The prgmGKSRC is getKey movement for sprite X,Y (like If getKey(1):Y+2->Y) and I move the sprite all over the screen right ABOVE THE OTHER SPRITE, and still the program never closes.

What am I doing wrong?

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #214 on: April 18, 2011, 09:38:27 am »
1) Yes

2) If its 4 pixels tall, that means starting at the top left corner, there is a black pixel at Y+0,Y+1,Y+2, and Y+3, and there is white everywhere else.  Y+5 will *not* trigger.

3) Return does not close the program if you are inside a subroutine, are you inside a subroutine?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #215 on: April 18, 2011, 09:45:20 am »
1) Yes

2) If its 4 pixels tall, that means starting at the top left corner, there is a black pixel at Y+0,Y+1,Y+2, and Y+3, and there is white everywhere else.  Y+5 will *not* trigger.

3) Return does not close the program if you are inside a subroutine, are you inside a subroutine?

1) Thanks
2) I tried 4, didn't work
3) I am not in a subroutine and I changed 'Return' to other stuff, nothing worked.

Perhaps I should post all the code:

POPSRC
Code: [Select]
.POP
prgmPOPSTUP
Repeat getKey(15)
prgmGKSRC
If pxl-Test(X,Y+4)
Return
End
Pt-On(20,55,[FFFFFFFFFFFFFFFF
Pt-On(X,Y,[FF42241800000000
End

prgmPOPSTUP
Code: [Select]
..SETUP
Asm(EF4645EF7045FDCB00AE

prgmGKSRC
Code: [Select]
..GETKEYS
DispGraphClrDraw
If getKey(1) and (Y<60
Y+2->Y
End
If getKey(2) and (X>0
X-2->X
End
If getKey(3) and (X<88
X+2->X
If getKey(4) and (Y>0
Y-2->Y
End
« Last Edit: April 18, 2011, 09:46:24 am by Scout »

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #216 on: April 18, 2011, 09:54:48 am »
Could it be that you are clearing the screen right before you pixel test, and that there hasn't been anything drawn to the screen yet?  Try doing the test after the sprite displays.  And also, stick with +4, I didn't realize you were trying to detect the *other* sprite :)

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #217 on: April 18, 2011, 10:16:38 am »
Could it be that you are clearing the screen right before you pixel test, and that there hasn't been anything drawn to the screen yet?  Try doing the test after the sprite displays.  And also, stick with +4, I didn't realize you were trying to detect the *other* sprite :)

It worked perfectly! My program just became a lot bigger though :S

Old size: 497 bytes
New size: 528 bytes

The difference between old and new is a a or:

Old program:
Code: [Select]
If pxl-Test(X+3,Y+5
Return
End

New program:
Code: [Select]
If pxl-Test(X+4,Y+5 or ((pxl-Test(X+3,Y+5
Return
End

The 'or' is big in Assembly in seems.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #218 on: April 18, 2011, 10:22:39 am »
Why did you add the second pixel test command?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #219 on: April 18, 2011, 10:24:46 am »
Why did you add the second pixel test command?

My sprite is like:

MySprite:
 .db $FF
 .db %01000010
 .db %00100100
 .db %00011000
...


So it's like an arrow, but it's point  has two sprites. I'll change the sprite though =D
« Last Edit: April 18, 2011, 10:27:56 am by Scout »

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #220 on: April 18, 2011, 10:26:48 am »
Oh gotcha, well glad you got it working :D

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #221 on: April 18, 2011, 10:36:15 am »
Also, I'm pretty sure that Rect( is much bigger than Pt-On(.

Size with Pt-On:
Pt-On(20,56,[FFFFFFFFFFFFFFFF
542 bytes
Size with Rect(:
Rect(20,56,8,8
650 bytes

Also, it's bigger, in this case, does it also mean it's faster?

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #222 on: April 18, 2011, 10:44:55 am »
Actually Rect() is smaller, but since you still have the other Pt-On in your program, it still has the Pt-On subroutine and is *also* adding in the Rect() subroutine, making it larger.  Also note that size doesn't necessarily have any correlation with speed, but smaller is in general faster.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #223 on: April 18, 2011, 10:48:31 am »
Actually Rect() is smaller, but since you still have the other Pt-On in your program, it still has the Pt-On subroutine and is *also* adding in the Rect() subroutine, making it larger.  Also note that size doesn't necessarily have any correlation with speed, but smaller is in general faster.

It only uses the defines/subroutines it needs, smart Quigibo.

rand^n generates a number from 0 to n? Including 0 and n? Or from 0 to n+1? Wondering.

Also, can I have a Lbl B and a variable B in the same program and they won't be confused?
« Last Edit: April 18, 2011, 10:49:54 am by Scout »

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #224 on: April 18, 2011, 10:57:11 am »
rand^n generates a random number from 0 to N-1.

and you can have Lbl B and variable B and the program will have no issue :)