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

0 Members and 2 Guests are viewing this topic.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Q&A
« Reply #795 on: October 21, 2011, 07:39:44 pm »
I can't believe I forgot everything about freq() syntax after AxeSynth....But try it with less than 255. I'm not too famliar with float{} either- do you need the superscript r?

Quigibo: Sounds nice (the tables) Perfect for enemies, let's hope we don't get hopelessly confused people trying to use them as tilemaps LOL :P

Does anyone remember how the file object is structured? I remember it's 3 bytes large; but does oY1 point to the page number or the pointer within the page?

Offline jacobly

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 205
  • Rating: +161/-1
    • View Profile
Re: Axe Q&A
« Reply #796 on: October 21, 2011, 08:04:24 pm »
Going by Axe.inc, {oY1}r is the address and {oY1+2} is the page.
So to answer your question, the pointer comes first.

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #797 on: October 24, 2011, 08:27:02 pm »
How would I make something where blocks fall from the top of the screen at different x coordinates?  I have rand^94 listed several times and stored as different variables and displayed at different times. Is there a better way to do this?

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Q&A
« Reply #798 on: October 24, 2011, 08:47:21 pm »
Well, assuming that you assign each block an X and Y coordinate in a buffer, you could simply do a 'rand^94' when assigning an x coordinate, then leave it alone.

Pseudo-code:
Code: [Select]
0->block_count

While game_is_running == True:
    If create_a_block == True:
        rand^94->{block_count * 2 + L1}  // X-coordinate
        0->{block_count*2 + 1 + L1}      // Y-coordinate
        block_count++
    End
   
    For(A, 0, block_count):              // or is it 'For(A, 0, block_count - 1)' ?
        {block_count*2 + 1 + L1}++       // Increment each Y-coordinate so that every block moves down
    End

    [game code here]

End

My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #799 on: October 24, 2011, 09:05:05 pm »
Well, assuming that you assign each block an X and Y coordinate in a buffer, you could simply do a 'rand^94' when assigning an x coordinate, then leave it alone.


I wanted to have multiple blocks appear at the same time. I have
this listed

Code: [Select]

.Creating x

rand^94->I
rand^94->J
rand^94->K
rand^94->L
rand^94->M

.Some other stuff

.Drawing

If D<140
D+1->D
Pt-On(I,D,Pic2)
Pt-On(J,D-20,Pic2)
Pt-On(K,D-40,Pic2)
Pt-On(L,D-60,Pic2)
Pt-On(M,D-80,Pic2)
end

.More other stuff

.Checking if blocks collide with Pic1 which is located at x,y

If abs(I-X)<8
If abs(D-Y)<8
Return
End
End
If abs(J-X)<8
If abs(D-20-Y)<8
Return
End
End
If abs(K-X)<8
If abs(D-40-Y)<8
Return
End
End
If abs(L-X)<8
If abs(D-60-Y)<8
Return
End
End
If abs(M-X)<8
If abs(D-80-Y)<8
Return
End
End

Takes up a lot of space, though
« Last Edit: October 24, 2011, 09:14:19 pm by epic7 »

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Q&A
« Reply #800 on: October 24, 2011, 09:34:28 pm »
Same thing, except with 100 blocks (Muhahaha).

Code: [Select]
.Number of blocks (don't exceed about 350)
100->N

.Clearing L1 (there are more efficient ways to do this,
.but I can never remember the exact syntax).
For(I,0,N*2)
    0->{L1+I}
End

While 1


    .Creating X and Y
    For(I,0,N)
        If {I*2+L1+1} > 64
            rand^94->{I*2+L1}
            0->{I*2+L1+1}
        End
    End
   
    .Some other stuff
   
    .Drawing
    For(I,0,N)
        I*2+L1->J
        Pt-On({J},{J+1},Pic2)
        {J+1}+1->{J+1}
    End
   
    .More stuff
   
    .Collision check
    For(I,0,N)
        I*2+L1->J
        If abs({J}-X)<8
            ReturnIf abs({J+1}-Y)<8
        End
    End
   
    .Obligatory emergency exit
    ReturnIf getKey(15)
End

You probably would want to lower the number of blocks + make tweaks so they don't fall down all at once.

Also, you can see that in this example I used a 'For' loop several times -- it would be generally better if you could optimize it into a single loop.

Code: [Select]
.Number of blocks (don't exceed about 350)
100->N

.Clearing L1 (there are more efficient ways to do this,
.but I can never remember the exact syntax).
For(I,0,N*2)
    0->{L1+I}
End

While 1
    .Some stuff

    For(I,0,N)
        .Creating X and Y
        If {I*2+L1+1} > 64
            rand^94->{I*2+L1}
            0->{I*2+L1+1}
        End
       
        .Drawing
        I*2+L1->J
        Pt-On({J},{J+1},Pic2)
        {J+1}+1->{J+1}
       
        .Collision Check 
        I*2+L1->J
        If abs({J}-X)<8
            ReturnIf abs({J+1}-Y)<8
        End
    End
   
    .More stuff
   
    .Obligatory emergency exit
    ReturnIf getKey(15)
End

The above code relies on pointers/free ram -- a crucial part of Axe programming.

See Deep Thought's wonderful tutorials on both:

http://www.omnimaga.org/index.php?action=articles;sa=view;article=59
http://www.omnimaga.org/index.php?action=articles;sa=view;article=61
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #801 on: October 24, 2011, 09:39:01 pm »
What do curly brackets do?

Offline Netham45

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2103
  • Rating: +213/-4
  • *explodes*
    • View Profile
Re: Axe Q&A
« Reply #802 on: October 24, 2011, 10:08:38 pm »
The curly brackets dereference a pointer.
http://eeems.omnimaga.org/Files/Resources/program%20readmes/Axe/Commands.htm#Das is the usage instructions.

Lets say you have the following expression: {L1}
L1 essentially always contains the number 0x86EC (or 34540 in base 10). This happens to be the address of a safe spot in RAM.

Now, the memory in any computer is laid out numerically. The 83+'s have each individual number equal to one byte of storage space in the calculator. That means that each number can essentially hold from 0 to 255. L1 can hold from 0-255, L1+1 can hold from 0-255.

{L1} would get you the value of the number at 0x86EC. {L1+1} would get you the value of the number at 0x86ED.

These numbers can then be used as a normal variable. For example:

1->{L1} would store 1 into 0x86EC, or L1. 2->{L1+1} would store 2 into 0x86ED, or L1+1.


Lemme know if this doesn't clear it up for you.
Omnimaga Admin

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #803 on: October 24, 2011, 10:24:56 pm »
Had to read it over like 5 times first since I'm half asleep right now :P.


So is L1 a list, or a number?
It holds from 0-255 numbers....L1+1 still holds 0-255?

If I used
1->{L1} it could be used as a normal variable like if I used 1->x?

Would {L1+1} be related at all to L1 or not since it is at a different adress?

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 #804 on: October 24, 2011, 10:29:01 pm »
L1 in Axe is not a list, it points to a block of data.  So, it's a "pointer". That's all the buffers are, spots of memory that tend to be empty, and are safe (for the most part) to use for data storage.

And yes, {L1} can be used as a normal variable, though it will only hold 0-255 if it's one byte.

{L1+1} is related to {L1} only that it's the byte immediately following the latter.


Hope this helps :)
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 #805 on: October 24, 2011, 10:29:58 pm »
Every byte on the calculator has an address, and that address is called a pointer.




Offline Netham45

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2103
  • Rating: +213/-4
  • *explodes*
    • View Profile
Re: Axe Q&A
« Reply #806 on: October 24, 2011, 10:31:28 pm »
L1 in terms of axe is a static value. It's not a list.

{L1} is one variable, {L1+1} is another, {L1+2} is another. They are all at independent addresses.

Note that it's possible to combine two addresses to form a 16-bit number, or a number from 0-65535 by using {L1}r. This would use L1 and L1+1 to store the larger number.

Edit: If you know what an array is, think of the memory as a giant array from 0x0000-0xFFFF (though obviously not all of this is writable). The brackets simply return the index in ram that you specify as a variable.
« Last Edit: October 24, 2011, 10:34:49 pm by Netham45 »
Omnimaga Admin

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #807 on: October 24, 2011, 11:23:17 pm »
Would this just be used for storing variables, or does it have other uses.

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 #808 on: October 24, 2011, 11:45:56 pm »
short answer: yes.
long answer: depends on what you want to do with it. That's the beauty of midlevel languages like Axe--everything is what you want it to be.
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 Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Axe Q&A
« Reply #809 on: October 24, 2011, 11:52:17 pm »
Well what is really cool about it is that you can give each block an addressed X and Y
each block will take 2 bytes, one for x and one for y.
Block 1 will take memory locations {L1+0} and {L1+1}
Block 2_______________________{L1+2} and {L1+3}
Block 3_______________________{L1+4} and {L1+5}
and so on.
Since you know the location of each of these variables, you can save allot of code by jumping to the next byte.

so instead of doing
Pt-On(A,B,Pic1)
Pt-On(C,D,Pic1)
Pt-On(E,F,Pic1)
Pt-On(G,H,Pic1)
Pt-On(I,J,Pic1)
Pt-On(K,L,Pic1)
and so on...
you can do this...
    For(A,0,N)
        Pt-On({A*2+L1},{A*2+L1+1},Pic1)
    End


This will also let you easily change the number of blocks in THE GAME by just changing N
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________