Quote: "I don't think someone starting out programming should be writing tools / libraries of code to help them with future projects. A lot of times you have to try different methods, see what works and what doesn't, and learn more about programming in general before tackling those things. That, and it is BOOOORRING"
I disagree my good sir
Firstly at least in my case, it's much more interesting actually getting a 'smart' concept out on code, than it is to have a character walking around. Comes down to personality, some like others don't
Second, it teaches good programming principles. I've learned more by attempting to jot down theory into functions and subroutines than just pumping out a quick FPS or shooter game.
For instance, I notice a lot of games that suffer from some simple common issues. Such as moving faster diagonally than forward/sideways, or movement & animation speed tied to framerate
Both of which can be sorted with a decent function.
Movement for instance should not be written as
if pressing up then inc PlayerPosZ,1
if pressing left then inc PlayerPosX,1
This would cause you to move ~50% faster diagonally
If sticking with digital input (i.e. keyboard) you need to multiply the speed by 0.707
If using analogue input you need to determine angle and distance from the center, otherwise a joystick will again move ~50% faster when pointing diagonally
These are the sorts of things that aren't apparent when you start coding, but down the track you notice them and then go to 'fix' them. It's a lot more difficult to fix than it is to recode if you are heavily invested. As this may mean altering code in several different area's. THATS boring
Here is my function to handle both keyboard and 360 controller for movement, and is framerate independent. This was coded from the very start of my project
Function MovementVelocity(unit,axis$)
x#=(Marine(unit).Speed/1000.0)*(hitimer(1000)-GameTimer(0))
y#=(Marine(unit).Speed/1000.0)*(hitimer(1000)-GameTimer(0))
xcount#=0.0
ycount#=0.0
count#=1.0
result#=0.0
Inc xcount#,keystate(32)
Dec xcount#,keystate(30)
Inc ycount#,keystate(17)
Dec ycount#,keystate(31)
If xcount#<>0 And ycount#<>0 Then count#=(abs(xcount#)+abs(ycount#))*0.707
If axis$="x" Then result#=(x#*xcount#)/count#
If axis$="y" Then result#=(y#*ycount#)/count#
If Xb360 Controller Connected(0) And result#=0.0
ix#=xb360 thumb right x(0)
iy#=xb360 thumb right y(0)
Xb360 Poll 0
A2text Verdana(12),0,200,"Left/Right:"+str$(xb360 thumb left x(0)/32767.0),rgb(255,255,255)
A2text Verdana(12),0,220,"Up/Down:"+str$(xb360 thumb left y(0)/32767.0),rgb(255,255,255)
Inc xcount#,xb360 thumb left x(0)/32767.0
inc ycount#,xb360 thumb left y(0)/32767.0
If axis$="x" Then result#=(x#*xcount#)
If axis$="y" Then result#=(y#*ycount#)
If ix#<>0 And Xb360 Thumb Right X(0)=0 or iy#<>0 And Xb360 Thumb Right y(0)=0 then position mouse screen width()/2,screen height()/2
If Xb360 Thumb Right X(0)<>0 Or Xb360 Thumb Right Y(0)<>0
A2text Verdana(12),0,250,"Left/Right:"+str$(xb360 thumb right x(0)/32767.0),rgb(255,255,255)
A2text Verdana(12),0,270,"Up/Down:"+str$(xb360 thumb right y(0)/32767.0),rgb(255,255,255)
Position Mouse screen width()/2+((xb360 thumb right x(0)/(32767.0/(screen width()/2.5)))),screen height()/2-((xb360 thumb right y(0)/(32767.0/(screen height()/2.5))))
Endif
Endif
Endfunction result#