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

0 Members and 2 Guests are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #240 on: April 25, 2011, 06:04:10 am »
Thanks calc84maniac and Michael Lee :) I found another way of doing it though.

I have a new question... How to handle 2 byte highscores with appvars?

I just need to store 1 value in the appvar, but it is over 255.

I have the appvar created with 2 bytes of size, they are all I need.

I tried 500->{T+1} and 500->{T} and then to display it tried Text(X,Y,{T}>Dec and Text(X,Y,{T+1}>Dec.

What should I do?

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Axe Q&A
« Reply #241 on: April 25, 2011, 06:40:33 am »
add an r at the end of the {}s
500->{T}r
Text(X,Y,{T}r>Dec
« Last Edit: April 25, 2011, 06:42:27 am by Binder News »
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #242 on: April 25, 2011, 06:42:54 am »
Thx binder, graduados gás already told me thogh. Thx :)

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Axe Q&A
« Reply #243 on: April 25, 2011, 06:43:18 am »
Welcome :)
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #244 on: April 28, 2011, 09:31:38 am »
I have a new question :$

How to check if a number in a variable is divisible by another number.

Let's say I have the var B and want to check if it is divisible by 5. Axe is an integer language, so can that be done?

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Axe Q&A
« Reply #245 on: April 28, 2011, 09:35:49 am »
!If A^B
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

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 #246 on: April 28, 2011, 09:49:44 am »
Yep, remember ^ (modulus) is just the remainder after division, so if it's zero, there is no remainder (it's divisible).




Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #247 on: April 28, 2011, 09:55:42 am »
Yep, remember ^ (modulus) is just the remainder after division, so if it's zero, there is no remainder (it's divisible).

I had no idea there was such an operator. Thanks :D

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #248 on: April 29, 2011, 02:16:02 pm »
I have a new question:

Code: [Select]
:If X=88 or (Y=62 or (X=65532 or (pxl-Test(X-1,Y+2 or (pxl-Test(X-1,Y+3 or (pxl-Test(X-1,Y+4 or (pxl-Test(X,Y+1 or (pxl-Test(X,Y+5 or (pxl-Test(X+1,Y+1 or (pxl-Test(X+1,Y+6 or (pxl-Test(X+2,Y or (pxl-Test(X+2,Y+7 or (pxl-Test(X+3,Y+8 or (pxl-Test(X+4,Y-1 or pxl-Test(X+4,Y+8 or (pxl-Test(X+5,Y or (pxl-Test(X+5,Y+8 or (pxl-Test(X+6,Y or (pxl-Test(X+6,Y+8 or (pxl-Test(X+7,Y+8 or (pxl-Test(X+8,Y or (pxl-Test(X+8,Y+3 or (pxl-Test(X+8,Y+4 or (pxl-Test(X+8,Y+5 or (pxl-Test(X+8,Y+7
First of all, does this error have any problem? It doesn't seem to be working as I want it to. Is there a problem with parentheses or having too many pxl-Test.

Code: [Select]
:If X=88 or (Y=62 or (X=65533 or (pxl-Test(X+8,Y) or (pxl-Test(X+8,Y+7 or (pxl-Test(X+6,Y+1 or (pxl-Test(X+2,Y or (pxl-Test(X+7,Y+8 or (pxl-Test(X+7,Y-1 or (pxl-Test(X+2,Y+7 or (pxl-Test(X+3,Y+8 or (pxl-Test(X+4,Y+8 or (pxl-Test(X,Y+3
This works more or less.

Thanks, any help is appreciated.
« Last Edit: April 29, 2011, 02:16:26 pm by Scout »

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #249 on: April 29, 2011, 02:20:11 pm »
You should write a for loop for the pxl-test.
I'm not a nerd but I pretend:

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #250 on: April 29, 2011, 02:20:52 pm »
You should write a for loop for the pxl-test.

That's actually a very good idea, I never thought of it. Thanks.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #251 on: April 29, 2011, 02:22:43 pm »
You should do it this way:
Code: [Select]
0->Z
For(A,0,7
Z+Pxl-Test(X,Y+A)->Z
End
If Z!=0
blah blah
end
I'm not a nerd but I pretend:

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Axe Q&A
« Reply #252 on: April 29, 2011, 02:26:46 pm »
Code: [Select]
:If X=88 or (Y=62 or (X=65532 or (pxl-Test(X-1,Y+2 or (pxl-Test(X-1,Y+3 or (pxl-Test(X-1,Y+4 or (pxl-Test(X,Y+1 or (pxl-Test(X,Y+5 or (pxl-Test(X+1,Y+1 or (pxl-Test(X+1,Y+6 or (pxl-Test(X+2,Y or (pxl-Test(X+2,Y+7 or (pxl-Test(X+3,Y+8 or (pxl-Test(X+4,Y-1 or pxl-Test(X+4,Y+8 or (pxl-Test(X+5,Y or (pxl-Test(X+5,Y+8 or (pxl-Test(X+6,Y or (pxl-Test(X+6,Y+8 or (pxl-Test(X+7,Y+8 or (pxl-Test(X+8,Y or (pxl-Test(X+8,Y+3 or (pxl-Test(X+8,Y+4 or (pxl-Test(X+8,Y+5 or (pxl-Test(X+8,Y+7


I have that image (click and enlarge to view the pixels). The code above is supposed to make a pixel collision for copter. any ideas?


Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #253 on: April 29, 2011, 02:28:17 pm »
Do it the way I posted. this is a cheap, but good way for collission checking.
I'm not a nerd but I pretend:

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #254 on: April 29, 2011, 03:11:15 pm »
Here is a pretty small method for pixel-based sprite collision checking. Whereas your previous combination of 22 hard-coded pxl-Test() checks weighs in at a whopping 620 bytes, this routine is 99 bytes. As you might expect from this loop-based approach, though, it trades size for speed. Whereas your previous method would take about 9,000 cycles, this method will take about 26,000 cycles for your sprite.

Another great thing about this approach is that it, instead of using a large list of X and Y offsets for each pixel that you want to check, it simply reads from a sprite. This means that this routine can be adapted to any sprite by simply changing the Pic0 reference to point to your 8x8 sprite. However, this also means that is slowed down additionally by checking pixels inside of the sprite, which you may not need to check. You can get rid of these unnecessary checks by having this routine read from an 8x8 sprite only containing the collision points (probably the border). If you added another 8x8 sprite containing the 22 collision points you used in your hardcoded method, you would be adding 8 bytes for the sprite but subtracting about 6,000 cycles from the collision checking.

Code: (99 bytes, ~26,000 cycles if no collision (based on Scout's helicopter sprite)) [Select]
8
While 1
  -1→T    .that's a subtraction sign
  {+Pic0}→U
  8
  While 1
    -1→S
    If U^2
      If pxl-Test(X+S,Y+T)
        Goto COL
      End
    End
    U/2→U
  End!If S
End!If T
« Last Edit: April 29, 2011, 03:29:41 pm by Runer112 »