Author | Comment | thunderflea Marine Posted: 25 Oct 2009 12:47 GMT Total Posts: 15 | okay so when i start the program the map loads and the star moves up and down like i want it to, but the O that is your character moves all the way to the left and you cant control the O
:[[0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0] [0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0] [0,1,0,2,2,2,2,3,0,0,0,0,0,0,0,0] [0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0] [0,0,0,0,0,0,0,0,3,2,2,2,2,2,3,0] [0,0,0,0,3,2,2,0,1,0,0,0,0,0,1,0] [0,1,0,2,3,0,0,0,0,0,0,0,0,0,1,0] [0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0]]->[J] ClrHome For(I,1,8 For(J,1,16 If [A](I,J)=1 Output(I,J,"! If [A](I,J)=2 Output(I,J,"- If [A](I,J)=3 Output(I,J,"+
End End 2->A 1->B 1->C While 1 Output(A,10,"* Output(B,10," For(Z,0,200 End A->B A+C->A If A=4 or A=1 -C->C 0->K 4->O 8->P Lbl A While 1 Output(O,P,"0 getKey->K If P=8 and O=A:Goto W If K=24:Goto L If K=26:Goto R If K=25:Goto U If K=34:Goto D Lbl L Output(O,P," P-1->P Goto A Lbl R Output(O,P," P+1->P Goto A Lbl U Output(O,P," O-1->O Goto A Lbl D Output(O,P," O+1->O Goto A End End End End Lbl W:ClrHome:Output(4,8,"YOU WIN | haveacalc Guardian
Posted: 25 Oct 2009 17:19 GMT Total Posts: 1111 | Two big parts of programming are analyzing already-existing code that does what you want to do (possibly making it more efficient along the way) and independently programming the solution. Both are skills, so working at them makes you a stronger programmer in the future.
--- -quoted directly from most movies that don't exist (and some that do). | thunderflea Marine Posted: 25 Oct 2009 17:30 GMT Total Posts: 15 | but how do i fix it? do you have a tutorial that could teach me? | haveacalc Guardian
Posted: 25 Oct 2009 19:47 GMT Total Posts: 1111 | It looks like you're looking for a good way to do collision detection. Matrices work, but are memory-intensive, so strings are generally used instead. I would look at the code of BASIC RPGs on this site and/or others. As for tutorials, I would look at those listed on TI-Freakware.
--- -quoted directly from most movies that don't exist (and some that do). | me2 Goliath
Posted: 27 Oct 2009 10:05 GMT Total Posts: 171 | Your program is too complex with too many labels. For simple colision detection, use something like this:
: Lbl 1 AxesOff FnOff 0Xmin 94Xmax 0Ymax -62Ymin ClrDraw DelVar P 50Q Lbl C DelVar L P+1P //Increase the level number by one Text(40,30,"LEVEL: Text(40,64,Ans Pause ClrDraw Horizontal 0 Vertical 0 Horizontal -62 Vertical 94 For(X,0,Q Pxl-On(randInt(1,61),randInt(1,93 //Draws 50 random points (obstacles) End 26R 48B 32A Repeat pxl-Test(Ans,B) or L=320 //Repeat until you hit something or beat the level\\ Pxl-On(Ans,B L+1L //Keeps track how many pixels you've moved getKey If Ans:AnsR B-(R=24)+(R=26B A-(R=25)+(R=34A End If L=320:Then //If you moved 320 pixels (won the level) Q+100Q //Increase the number of obstacles to be drawn by 100 Goto C End ClrHome Disp "YOU DIED","YOUR SCORE:",(P-1)320+L ClrDraw
You could of course draw specific obstacles rather than random ones. Matrices are only necessary when programming large RPGs.
--- <--- Going out with a bang. |
|