OK, first things first,
I would structure it (while simple) something like this
type Character_Type
speed# as float
health as integer
attack as integer
defence# as float
rof# as float
endtype
dim main_character(2) as Character_Type
setup_characters()
main_code
end
function setup_characters()
`Character 1
AttkSpeed(1).speed# = 6.72
AttkSpeed(1).health = 676
AttkSpeed(1).attack = 129
AttkSpeed(1).defence = 0.2 : `would this be the proper way to represent 20%? - Yes, but not in an integer
AttkSpeed(1).rof# = 1.80 : `So this character will be able to do 129 damage every 1.8 seconds - OK
`Character 2
AttkSpeed(2).speed = 6.48
AttkSpeed(2).health = 754
AttkSpeed(2).attack = 129
AttkSpeed(2).defence = 0.2
AttkSpeed(2).rof = 1.80
endfunction
function main_code()
battle_characters(1, 2)
display_results()
wait key
end
endfunction
function battle_characters(r_Character1, r_Character2)
`Place your character battle code in here
endfunction
function display_results()
endfunction
A few tips on the structure first.
Keep a note of your data structure requirements, integers, strings, floats etc.
There is a convention when writing them out that goes like this:
a float = variable#
a string = variable$
and integer/dword = variable
This will help you see what type of variable you are using when you code gets bigger.
I also use a descriptor for the type of variable, global, local etc in the variable.
global variable = g_variable
local variable = l_
a variable passed into a function (received variable) = r_
This just helps me structure it so I can always tell what is going on. I also read that if the variable name is above 9 characters DB makes it a 32 bit variable, not 16, or something, I don't know if thats right, but when I program a project I make the variable names the minimum length to fully describe what the variable is to myself so not things like CxN$ when I can call it g_Character_Demon_Hell1_Name$ etc, though I find naming easier with arrays, probably because you end up with far more variables for controlling the program than you ever have arrays for storing things.
If you want advice on the code for battles you will have to let me know what you are trying to do.