Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: hellninjas on May 09, 2012, 11:23:51 am
-
It's me again, still trying to figure out bullets. I received some help form Derf, and it was very helpful, I feel that I am very close to figuring this out!
But I have a problem, I can't figure out what's wrong with this code, as it does not work for me...
Below is the code I received from Derf, if you could help me, it would be much appreciated :D
0->G
repeat getkey(15)
DispgraphClrdraw
For(G,1,I) //Repeat code for every bullet
Pxl-Off{L1+(G*4)},{L1+(G*4)+1}) //Turn display for bullet off
If {L1+(G*4)+2}=1:{L1+(G*4)+1}-1->{L1+(G*4)+1} //Depending on what direction bullet has, move it that way
End
If {L1+(G*4)+2}=2:{L1+(G*4)}+1->{L1+(G*4)}
End
If {L1+(G*4)+2}=3:{L1+(G*4)+1}+1->{L‚+(G*4)+1}
End
If {L1+(G*4)+2}=4:{L1+(G*4)}-1->{L1+(G*4)}
End:End
For(G,1,I) //Repeat code for every bullet
If pxl-Test({L1+(G*4)},{L1+(G*4)+1}) //If hits a lit up pixel (wall), move coordinates to 0,0 (storage)
0->{L1+(G*4)}->{L1+(G*4)+1}
Else
Pxl-On({L1+(G*4)},{L1+(G*4)+1}) //Otherwise, turn the bullet back on
End
I'm not entirely sure why this isn't working...
-
Aren't there some ends missing at the end of the code? (two i think)
-
I have those in my code, I guess I forgot to type them x.x
-
You need:
GetKey → K //Should have this at start of program loop
If K=1 //If key pressed is down
1 → {L1+(G*4)+2} //Store 1 to that bullets direction variable
End
If K=2.... etc.
-
You need:
GetKey → K //Should have this at start of program loop
If K=1 //If key pressed is down
1 → {L1+(G*4)+2} //Store 1 to that bullets direction variable
End
If K=2.... etc.
Optimize it please x) :
GetKey
!If -1
.getKey=1
Else!If -1
.getKey=2
Else!If -1
.getKey=3
...
-
You should just be using getKey() instead of the BASIC-style getKey->var :P
-
It's all in but I still can't get it to work ;.;