Detecting a hit on the enemy is given by an if test OR any other viable test…such that if bullet coordinate =enemy coordinate then a hit is score…I SUGGEST U USE VARIOUS LISTS TO DO COMPARISONS OF COORDINATES AND TO REGISTER HITS

It is difficult to move and hit at the same time…mainly because movement is given mostly by "getkey" and hit is detected by an IF (or any otehr viable) test of <bullet coordinate=enemy coordinate>…given that TI BASIC only allows one program to run at any one time…it is impossible to move and detect a hit at anyone time…ESPECIALLY IF YOUR PROGRAM IS LONG, what you wud see will be that there is a CONSIDERABLE LAG between u PRESSING THE BUTTON, MOVEMENT OF THE ENEMY and REGISTRATION OF THE HIT

HOWEVER, you can turn it to a strategy game, such that you plot the positions of your shooters at different times first, randomise movement of the enemy and then perform the simulation…without you pressing any button during runtime…then DO A FINAL REGISTRATION OF THE NUMBER OF HITS BETWEEN U AND THE ENEMY TO DECIDE WHO WINS, AI OR U

]]>` ``:Clrdraw :Zstandard :30->A :10->B :While 1 :A->D :B->E :getkey->C :A-5(C=25 and A>10)+5(C=34 and A<50)->A :text(A,B,"> :text(A-5,B,"2 spaces :text(A+5,B,"2 spaces :If C=21 :Then :Repeat E=90 :text(D,E,"- :textD,E,"2 spaces :E+1->E :End:End`

thats pretty much it i was wodering how to shoot and be able to move at the same time and also how to make bad guys come out seperatly and in alternating places. and how to make them disapear when they are hit ]]>

` ``[[code]] insert the code here [[/code]]`

Hence, for example

:Lbl A

:text(X,Y,"-") \\assuming - is bullet

:text(X-1,Y," ") \\space as deleter \\assuming bullet shoots in X direction

\\YOU SHUD PUT THE DELETER AFTER the appearance of the new "bullet"…NOT BEFORE cos it is harder for the human eye to detect 2 pixels as compared to an empty space…this will impact the later part of the prog.when the prog. runs slightly slower due to lesser memory

:X+1->X

:goto A

u shud now see a bullet instead of a beam

]]>` ``:Zsquare :25->A :6->H :1->B :50->T :90->S :41->Z :32->Y :25->W :text(1,1,"[5 spaces here]then minus sign 74x :text(57,1,"[same thing as above] :while 1 :getkey->theta [i know you can just leaves getkey as is and use ans] :A-5(theta=25 and A>6)+5(theta=34 and A<50)->A [for moving] :text(A+5,B,"[4 spaces] :text(A-5,B,"[4spaces] :text(A,B,"> :if theta=21 :text(A,B+5,"----------- [11 minuses] :text(A,5,"[47 spaces] :S-2(S>1)->S [AI movement] :text(T,S,"<- :text(W,S,"<- :text(X,S,"<- :text(Y,S,"<- :text(Z,S,"<- :if A=T or W or X or Y or Z :p+1000->p :end`

i know this isnt the best code ever and i have question on how i can make ai come out seperatly also how to make a projetile shoot instead of a beam and how i can get it to clear it self also how to make he targets come out multuple time and how to make them disappear after they are shot

srry that i havent said anything in awhile i have been busy with schhol stuff so thats y. but could someone show me code of a guy that can move and shoot with hit detection on enemies still having trouble with this.

**thanks much everyone**

Which arcade games have you made so far?

]]>also thx for all the help so far =] ]]>

` ``line(A,B,A,B,not(K`

Hm, that's a neat optimization. I think I'm going to use that in my code from now on. Anyway, this code is much easier to understand. Since the coordinate (A,B) is used twice, the Line( routine draws a line from (A,B) to (A,B). On the screen, this shows up as a single point. When K is not zero, the Not( function inverts it and returns a 0, which causes the Line( function to erase the point at (A,B). When K is zero (no buttons are pressed), the Not(K returns a 1 and the routine draws the point on the screen.

]]>` ``:min(94,max(0,A+sum(Δlist(K={24,26→A`

Is now interpreted as:

` ``:min(94,max(0,A+sum(ΔList({1,0}→A`

ΔList( returns the difference between elements in a list. So in {1,0}, to get from 1 to 0 you add -1, so ΔList({1,0 returns {-1}. Take the sum of that list and you get -1. That brings the line of code down to:

` ``:min(94,max(0,A-1→A`

The max takes the max of 2 numbers, so if A-1 is less than 0, 0 is used instead (to prevent from going off the screen) and min takes the smaller of the two numbers.

I hope that helps!

]]>` ``:Zstandard :104→Xmax :72→Ymax :Zinteger :1→A :1→B :Repeat K=21 :getKey→K :line(A,B,A,B,not(K :min(94,max(0,A+sum(Δlist(K={24,26→A :min(62,max(0,B+sum(Δlist(K={34,25→B :End`

im not sure how to interpret this in to my own words so that i understand what each command does and how to add other things to it to make it shoot or something alond those lines

]]>You have several options such as matrices, lists, or real vars. you can use these to store coordinates or an object

This depends on whether you want to use text or if you want to draw on the graph. Here you have Line(,Pt-On(,pxl-On(, et cetera.

This is usually crucial if you want the user to control movement, By doing something like getKey→A, you can detect what key is being pressed and make it perform some actions.

To keep things simple, you can use If statements to control what happens when a key is pressed, but as you get more advanced and your understanding of TI-BASIC increases, you can move on to more optimised code. Here is a simple example:

` ``1→X 1→Y Repeat A=45 ;If the keypress is 45, this means clear Output(Y,X,"O ;This will display an O on the homescreen Repeat A≠0 ;The code until the next end is repeated until A is not 0 getKey→A ;This stores the keypress to A End ;This ends the Repeat block, so only getKey→A is repeated Output(Y,X," ;There is a space after the ". This draws over the O If A=26 ;26 is the key for the right arrow X+1→X If A=24 ;24 is right X-1→X If A=25 ;25 is up Y-1→Y If A=34 ;34 is down Y+1→Y If X=0 ;If you try to use Output( and the X or Y is 0, you will get an error! 16→X If X=17 ;There are only 16 chars across, so you cannot Output( to column 17! 1→X If Y=0 8→Y If Y=9 1→Y End`

That code is horribly unoptimised, but it should be slightly easier to follow. As for hit detection, if the bad guy has his coordinates at (B,C), then you can simply compare (X,Y) to (B,C) using some simple math (like

I hope that helps a little!

]]>