Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: parserp on October 13, 2011, 06:54:44 pm
-
I am looking for a tutorial on jumping, but one for a COMPLETE beginner.
I haven't been able to understand any so far. :-\
If you could explain it or recommend a tutorial that would be great. ;D
[random question]
I have been noticing that in advanced programs in axe, (such as the demo rpg) in the beginning the sprites are declared and then it just has something like this:
:[FF36C78465378FC
1636374858CCFCF3
352CFFFC3T5376CD
3]
:
but it doesn't store it or anything.
what is the use of this?
[/random question]
-
I know this is written for TI Basic, but it is still very applicable to Axe code. I highly recommend it.
http://www.omnimaga.org/index.php?action=articles;sa=view;article=37
-
/me reads the tutorial...
thanx ztrupet :D
-
[random question]
I have been noticing that in advanced programs in axe, (such as the demo rpg) in the beginning the sprites are declared and then it just has something like this::[FF36C78465378FC
1636374858CCFCF3
352CFFFC3T5376CD
3]
but it doesn't store it or anything.
what is the use of this?
[/random question]
All static variables are stored one after another in memory, so if you do something like[00]→GDB1
[FF]
then {GDB1+1} will be EFF.
-
[random question]
I have been noticing that in advanced programs in axe, (such as the demo rpg) in the beginning the sprites are declared and then it just has something like this::[FF36C78465378FC
1636374858CCFCF3
352CFFFC3T5376CD
3]
but it doesn't store it or anything.
what is the use of this?
[/random question]
All static variables are stored one after another in memory, so if you do something like[00]→GDB1
[FF]
then {Str0+1} will be EFF.
ooh I think i get it now... XD
-
All static variables are stored one after another in memory, so if you do something like[00]→GDB1
[FF]
then {Str0+1} will be EFF.
For the record, Deep made a typo here. It should read:
...
[00]→GDB1
[FF]
then {GDB1+1} will be EFF.
-
That, and the colors are wrong. Fixed.
-
Ok, so I have another question...
So, this was my first attempt at using pointers in axe.
I've got the Idea, but not completely, so I don't know what I did wrong with this program.
It's for a game I'm making called swords, and all that I need to do is have the enemies walk across the screen and back.
Source and Executable are included...
and screenie!!!
EDIT: I'll just put the source here:
:.ENEMY
:.enemy
:[3C4289819F423C14]->Pic1
:.X position of enemies in L1
:For(A,1,5)
:(A*9)->{L1+A}
:End
:.which direction each enemy is going
:For(A,6,10)
:1->{L1+A}
:End
:Repeat getKey(15)
:ClrDraw
:Line(0,63,95,63)
:Line(0,0,95,0)
:Line(95,0,95,63)
:Line 0,0,0,63)
:.draw guys
:For(E,1,5)
:Pt-On(({L1+E}),55,Pic1)
:End
:Dispgraph
:.see if at edge
:For(F,1,5)
:If ({L1+F}=1) or ({L1+F}=86)
:((-1)*({L1+F}))->{L1+F}
:End
: End
:.actually move them
:For(C,1,5)
:({L1+C})+({L1+(C+5)})->{L1+C}
:End
:Pause 50
: End
-
After skimming your code which looks OK, I found four things:
- usually, you start arrays with the value zero, change that everywhere else.
- You have to use signed multiplication ( ** ) to multiply with a value less than zero.
- You are storing the direction value into the x-value, that won't work, so just add 5 to the pointer.
- If you use a version below 1.0.1 of axe, use the addition sign for conditions, not the 'or' keyword
:If ({L1+F}=1)+({L1+F}=86)
:-1**{L1+F+5}->{L1+F+5}
:End
To optimize a bit, use just one for loop for everything, than the speed will increase drastically.
:For(E,0,4)
:.from 0 to 4
:Pt-On(({L1+E}),55,Pic1)
:.see if at edge
:If ({L1+E}=1)+({L1+E}=86)
:-1**{L1+E+5}->{L1+E+5}
:End
:.actually move them
:{L1+E}+{L1+E+5}->{L1+E}
:End
:DispGraph
Hope that works
-
ooh yes it does. +1 XD
EDIT: but they just stop at the end, they don't reverse direction...
-
to optimize further, replace the parts where you use a for loop to set values with the Fill() command.
Example:
This:
:For(A,6,10) // A = [6,7,8,9,10]
:1->{L1+A} // {L1+6} = [1,1,1,1,1]
:End
could be this:
:Fill(L1+6,5,1) // {L1+6} = 5*[1] = [1,1,1,1,1]
See?
-
** Is fixed point multiplication, not signed multiplication. The regular * multiplication works for both signed and unsigned numbers.
-
** Is fixed point multiplication, not signed multiplication. The regular * multiplication works for both signed and unsigned numbers.
hey yeah that was the error. thanx XD
-
really, Quigibo? I could swear that in 0.5.3 it was signed.
-
It multiplies 2 signed fixed point numbers, the command has never changed since it was introduced. The only time ** is used is when dealing with decimal numbers or inflated coordinate systems, which is why its in the advanced math category.
-
Ok, thanks - now I learned something. ;)
-
Parser, do you still need help with jumping code?
-
Parser, do you still need help with jumping code?
no, I was able to figure it out, but thanks for asking. :)