KermMartian wrote:
Any interest in having the SourceCoder bot post up some code so that we can critique and optimize with you?
Of course!
Variables:
H= Horizontal Velocity
V= Vertical Velocity
S= Position along the x-axis
T= Position along the y-axis
K= keystroke
I often use S and T instead of X and Y because X and Y have a tendency to be overwritten.
Code: :ClrDraw
:Text(1,1,"
:real(0,1
:real(12,8,0,0,7,7,0
:real(12,8,3,3,4,4,0
:real(12,8,0,0,0,0,0
:real(12,8,0,7,0,7,0
:real(12,8,7,0,7,0,0
:real(12,8,7,7,7,7,1
:For(N,1,8
:For(M,1,8
:If fPart(.5(N+M
:Pxl-On(N-1,M+7
:End
:End
:real(9,1,4
:real(9,0,4
:real(0,1
:real(12,0,0,30,94,30,1
:For(N,0,11
:For(M,0,5
:real(1,8N,8M+30,1,8,4,1,0,2,0,1
:End
:End
:Text(1,3,"AIR
:Text(56,3,"FLUID
:Pause
://For those of you who are new to xLib programming, don't do what I did above in anything other than a demo; it's a disgusting way to set up sprites and the background every time the program is run. Below is the code that really matters.
:real(9,1,5
:real(9,0,5
:43→S
:5→T
:8→V
:3→H
:While 1
:real(3,5,0,0
:real(1,S,T,1,8,4,0,0,2,0,1
://Just so you know, the sprite is meant to slowly move towards the center of the horizontal axis. This way, losing it off screen is less of an issue for the video.
:H+1.5(H<0)-(H>0)+.8((S<46)-(S>46))→H
://This part is just an approximation, so any optimizations don't need to perform the exact same function.
:V-(T>26 and V>0)-(T>26)+3.4(T<26)+1.6((V<0)-(V>0))(abs(V)>3 and 3≥abs((T-26)→V
:iPart(S+H+(T>26)randInt(‾1,1)→S
:iPart(T+V→T
:getKey→K
:While K
:H+1.9((K=26)-(K=24→H
:V+2.1((K=34)-(K=25→V
:getKey→K
:End
:End
Quote:
How about a game where things fly right over the water, right under the water, and fall into the water, and you have to avoid them all?
Exactly; it could be done very easily. The only real issue would be to keep the game going at a speed adequate for TI83+s