Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: _player1537 on May 31, 2010, 04:36:00 pm
-
I'm trying to make an asteroids game, but I keep running into wierd errors, can anyone help. Basically what should happen is this: as you move around it will give you acceleration and you slow down gradually, but when you move to the left, it starts freaking out. I threw in a test so that when it triggers the "Too far left" code, it inverts the screen. The problem is, you move too far left every time you move left at all. Here's my code. I'm using the latest axe as well.
:.B
:[18183C3C3C000000020F1E0E0400000000001C1F1F1C0000000000040E1E0F02→Pic1
:[0000003C3C3C1818000000207078F040000038F8F838000040F0787020000000
:[0000001818000000→Pic2
:[0000183C3C180000
:0→X→Y
:0→T→S
:Pic1→D
:0→B
:Repeat getKey(15)
:If getKey(2)
:6→B
:End
:If getKey(3)
:2→B
:End
:If getKey(4)
:0→B
:End
:If getKey(1)
:4→B
:End
:If getKey(4) and getKey(2)
:7→B
:End
:If getKey(2) and getKey(1)
:5→B
:End
:If getKey(3) and getKey(4)
:1→B
:End
:If getKey(3) and getKey(1)
:3→B
:End
:If getKey(54)
:S+(getKey(3)-getKey(2)*2)→S
:T+(getKey(1)-getKey(4)*2)→T
:End
:Pt-Off(X/256,Y/256,B*8+Pic1
:If getKey(54)
:If (B=1) or (B=3) or (B=5) or (B=7)
:Pt-On(X/256,Y/256,Pic2
:Else
:Pt-On(X/256,Y/256,Pic2+8
:End
:End
:S/2+X→X
:T/2+Y→Y
:If S
:If S<<0
:S+1→S
:Else
:S-1→S
:End
:End
:If T
:If T<<0
:T+1→T
:Else
:T-1→T
:End
:End
:If X<<0
:DrawInv
:X+22528→X
:End
:If X>>22528
:X-22528→X
:End
:If Y<<0
:Y+14336→Y
:End
:If Y>>14336
:Y-14336→Y
:End
:
:DispGraph
:End
:Return:Lbl AA:For(A,0,1):For(B,0,1):Pt-Change(8*B+X,8*A+Y,2*A+B*8+D):End:End
-
:If S
:If S<<0
:S+1→S
:Else
:S-1→S
:End
:End
:If T
:If T<<0
:T+1→T
:Else
:T-1→T
:End
:End
These lines of code bug me. What if S or T equal 0?
-
then they won't get touched, the first If S line makes sure it is not zero the same with If T
-
Why did you inflate S and T by a factor of 2?
-
because I deflate S and T by 1 each time, that way it can get faster and faster the longer you hold the buttons, and then die down later. I could fix that another way, I might do that later
-
I think you need to do S//2 and T//2, because they are signed values.
-
Oh! thank you! yes, that was the bug, I completly forgot about the signed division routine.
-
Here is the code I was working with, if anyone wants to use this (even for the contest) go for it. Just figured I'd post it since I'm not going to work on it anymore. The group might be corrupted...
Edit: TILP output a .8Xgrp file, I changed it to that in hopes it would work with SC...it didn't
-
Sorry to hear you won't be working on it again anymore :(
-
eh, I've got other things to work on...and I know what I'm making for the contest now (between two things, although its probably the one me and SIr are having a competition (friendly competition) about :D )
-
yeah I understand x.x