Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Axe Programmer on May 01, 2013, 12:53:48 pm

Title: Axe Programming
Post by: Axe Programmer on May 01, 2013, 12:53:48 pm
Hello Programmers,

I was wondering if anybody could give a descriptive tutorial on how to make a shooting game. I cannot seem to figure out how to make rapid bullet fire and how to make multiple ships move around the screen. Thank You very much for your time and cooperation :)
 
Title: Re: Axe Programming
Post by: Hayleia on May 01, 2013, 01:01:44 pm
If you know how to handle one object, it is easy to handle several, using a For loop.
For example, to move one pixel from left to right, you do that:
:-1->A
:While 1
:  Pxl-On(A++,0)
:  DispGraph
:End
(yeah, infinite loop, I don't care)

Now, to move 10 pixels from left to right, you do that (unoptimized):
:Fill(L1,10,0)
:While 1
:  For(r1,0,9)
:    Pxl-On({r1+L1}++,r1)
:  End
:  DispGraph
:End

Now, I let you guess what to do with your ships and your bullets ;)
Title: Re: Axe Programming
Post by: ben_g on May 01, 2013, 01:13:04 pm
If you know how to handle one object, it is easy to handle several, using a For loop.
For example, to move one pixel from left to right, you do that:
:0->A
:While 1
:  Pxl-On(A,0)
:  DispGraph
:End
(yeah, infinite loop, I don't care)
...

I'd go for this:
:0->A
:While 1
:  Pxl-On(A,0)
A+1->A
:  DispGraph
:End

And if you use repeat getKey(15) instaed of While 1, you can quit the loop by pressing clear. But Hayleia has already said the most basic thing: If you know how to do one thing, you can easily do it multiple times by putting it in a for loop.
Title: Re: Axe Programming
Post by: aeTIos on May 01, 2013, 01:38:58 pm
You are asking for a tutorial for making a shooting game. That's about the same as asking us to make a shooting game. You also don't really say what you've got already, I'm sure you have already tried to make things. What are the problems you have? Don't you understand how to code things in Axe, or do you not understand the theory behind a shooter? Once we know where exactly to help you with, we are happy to answer!
Anyways, Deep Thought made a SHMUP (shoot-em-up) tutorial a while back here (http://ourl.ca/9422). Please note that this is written for an older version of Axe so information might not be 100% accurate. I am actually creating a SHMUP for PC right now, so I can also provide you with information.
Last but not least, welcome to Omnimaga, you can introduce yourself here (http://www.omnimaga.org/index.php?board=10.0)! I hope you enjoy your stay!
Title: Re: Axe Programming
Post by: Hayleia on May 01, 2013, 04:01:48 pm
If you know how to handle one object, it is easy to handle several, using a For loop.
For example, to move one pixel from left to right, you do that:
:0->A
:While 1
:  Pxl-On(A,0)
:  DispGraph
:End
(yeah, infinite loop, I don't care)
...

I'd go for this:
:0->A
:While 1
:  Pxl-On(A,0)
A+1->A
:  DispGraph
:End

And if you use repeat getKey(15) instaed of While 1, you can quit the loop by pressing clear. But Hayleia has already said the most basic thing: If you know how to do one thing, you can easily do it multiple times by putting it in a for loop.
Lol at first I had a A++ in the EndIf, which also means that my loop was not infinite, but then I wanted to simplify and forgot to put the A++ back -.-
And While 1 / EndIf getKey(15) is more optimized than Repeat getKey(15) / End ;)

(fixed my previous post)
Title: Re: Axe Programming
Post by: Axe Programmer on May 02, 2013, 01:05:01 pm


Thank You so much for all of the info. I can basically make any game i want to because I am quite familiar with axe.What I really need help is with the things called arrays. I think they are used for bullets in rapid fire. I want to be able to hold down the button with multiple bullets shooting. Can somebody please give me a description on arrays or something? It would really help. Thank you for your warm welcome :) ;D
Title: Re: Axe Programming
Post by: Matrefeytontias on May 02, 2013, 01:51:30 pm
Well, as everyone in this thread said before me (:P), if you can move one bullet, you can move 100 of them with a For loop. This is where arrays are useful.

The things you call "arrays" don't really exist in Axe, since there aren't any data type nor anything. What's there is plain RAM. But you can easily use it as an array-ish variable.

For example, let's use L1 ([2nd][1]). It's a pointer on a 768 bytes free RAM area, so it should be enough. Although it's in fact a simple area that you can go through using {r1+L1} where r1 goes from 0 to 767, you can also use another technique : use {r2*X+r1+L1}, where r2 goes from 0 to the number of rows minus 1 of your "array", X is the number of colons in your array and r1 goes from 0 to X - 1. Thus, you can pass r1 as the colon of an element of your array, and r2 as the row. And poof, you have an array.
Title: Re: Axe Programming
Post by: alex99 on May 04, 2013, 02:17:06 pm
i´ve three questions:
1.can you use the menu( in axe? if yes how?
2.in basic you have sub(str1,...,...).what is this in axe?
3.i want to copy sth to a prog.that that i want to store to a prog is located in a string.when in the string is stored --> tho
en it shall copy: "->".but how you can breake the copy and copy -> and go on whith the copy?
Title: Re: Axe Programming
Post by: Hayleia on May 04, 2013, 02:23:55 pm
1.No, you have to make your menus by yourself and it is not that bad. And the Z-Test command is quite useful for that if you want something that looks like Menu(.
2.Strings are, like any kind of data, handled by pointers, so just add an offset to your pointer. For example, if Text(0,,Str1) displays "wattouat", then Text(0,,Str1+1) displays "attouat" and Text(0,,Str1+2) displays "ttouat".
3.I didn't understand anything to the question
Title: Re: Axe Programming
Post by: alex99 on May 05, 2013, 06:49:28 am
thank you i ´m trieing now possibilities for 3.
Title: Re: Axe Programming
Post by: alex99 on May 18, 2013, 10:10:40 am
hey everyone
i´made a pic format for my own progs...
it is stored and executed in basic...
now i´m trying to port it into axe,but the axe prog is ram clearing...
info :
picsprite is stored into str1

prog for executing in basic:

Code: [Select]
:"?º'{^r}!{^T}{dot}{cross}{box},/*-+π{E}{e}{^3}{^2}{^-1}{}():."→Str0
:For(A,1,length(Str1)
:sub(Str1,A,1)→Str2
:inString(Str0,Str2)→B
:A+1→A
:sub(Str1,A,1)→Str2
:inString(Str0,Str2)→C
:Pxl-On(X+B,Y+C)
:End
in axe:
Code: [Select]
:.ASCLPIC
:GetCalc("Str1")→A
:GetCalc("uX")→{X}{^r}
:GetCalc("uY")→{Y}{^r}
:"?º'{^r}!{^T}{dot}{cross}{box},/*-+π{E}{e}{^3}{^2}{^-1}{}():."→Str0
:""→Str4
:length(A)=L
:conj(A,Str4,L)
:For(B,1,length(Str4
:Str4+B→P
:For(C,1,length(Str0)
:If Str0+C=P
:C→Z
:B++
:Str4+B→P
:For(C,1,length(Str0)
:If Str0+C=P
:C→θ
:sub(DW)
:End
:End
:End
:End
:End
:
:Lbl DW
:Pxl-On({X}{^r}+Z,{Y}{^r}+θ
i hope i find some help here...
Title: Re: Axe Programming
Post by: TheMachine02 on May 18, 2013, 12:15:10 pm
the first thing I see is in this part of code :

Code: [Select]
GetCalc("uX")→{X}{^r}
GetCalc("uY")→{Y}{^r}

if you do that, then then adresse of the var will store to the ram at x and y adresse
but if you don't define this var, it can do ram clear or data corruption if they are store where there should'nt be store  :P

use this instead :

Code: [Select]
Buff(2)->°X
Buff(2)->°Y
GetCalc("uX")->{°X}^r
GetCalc("uY")->{°Y}^r

this will store the adresse of the os' variable into a defined place locate in the compiled prog

the second thing I see is :

Code: [Select]
length(A)=L

in AXE, this will just do a comparaison. I suppose it should be

Code: [Select]
length(A)->L

And why do you use this :

Code: [Select]
Pxl-On({X}{^r}+Z,{Y}{^r}+θ

because with this code, you do a pxl-on at the pos (adresse os X)+Z,(adresse os Y)+θ
and in fact, why are you using os-vars ? (varX,varY) ? As I know, they don't even have the same format than axe var...

Title: Re: Axe Programming
Post by: alex99 on May 18, 2013, 12:21:15 pm
well i use them because i ´want to make this tool for basic programmers
x and y are pointing the sprite on that part where the basic prog it defines
and str1 is the sprite itself...


Code: [Select]
Buff(2)->°X
Buff(2)->°Y

is not working

axe parser shows
:err:name length  :banghead: :banghead: :banghead:
Title: Re: Axe Programming
Post by: jacobly on May 18, 2013, 12:52:15 pm
Just do float{GetCalc("varX")}→X and float{GetCalc("varY")}→Y and then you can use X and Y like normal Axe variables.
Title: Re: Axe Programming
Post by: alex99 on May 18, 2013, 01:29:53 pm
i changed getcalc( like jacobly said and it is every time showing a pxl at 10/60

the ehole prog is not working !!!!!!!!!
i need some help
is there mabey anywhere sth wrong...
or mabey you have another  possibility....
Title: Re: Axe Programming
Post by: alex99 on July 25, 2013, 03:41:22 am
is it possible to execute progs in axe
i mean:
1. i compile the axe prog
2. store another progname to a string
3. run the axe prog
4. the prog that is storen into a String runs
Title: Re: Axe Programming
Post by: Streetwalrus on July 25, 2013, 04:21:09 am
/me points to RunPRGM dy DrDnar
Title: Re: Axe Programming
Post by: Hayleia on July 25, 2013, 06:15:28 am
/me agrees with Streetwalker, and also point to thepenguin77's zStAxe Axiom to run any prog from an Axe program through zStart