half a battle engine with ATB
Author |
Message |
omni
|
Posted: Sun Apr 18, 2004 12:17 pm Post subject: half a battle engine with ATB |
|
|
This is the beginning of a RPG battle engine with Active Time Battles.
code: |
%Jeffery Liu
%-------- player 3s bar
%-------- player 2s bar
%-------- player 1s bar
var bar : array 1 .. 3 of int := init (1, 2, 3) %starting speed
var speed : array 1 .. 3 of int := init (2, 3, 1) %how fast you want to increment
var enemybar : array 1 .. 3 of int := init (3, 2, 1) %starting speed
var enemyspeed : array 1 .. 3 of int := init (1, 1, 2) %how fast enemy speed increments
var names : array 1 .. 3 of string := init ("Jeffery", "insert", "name") %insert names
var key : string (1)
locate (22, 7)
put "Enemys"
locate (22, 73)
put "Players"
loop
%increasing enemy speed
for count : 1 .. upper (enemyspeed)
if enemybar (count) > 50 then %checking if the bar reached the end
enemybar (count) := enemybar (count) - 50 %set speed to starting speed
locate (1, 1)
put "Enemy ", count, " turn"
getch (key)
else
enemybar (count) := enemybar (count) + enemyspeed (count) %otherwise increase
end if
end for
%drawing the bar
for count : 1 .. upper (enemybar)
drawfillbox (52, count * 10, 102, count * 10 + 10, brightgreen)
drawfillbox (102 + enemybar (count) - 50, count * 10, 102, count * 10 + 10, black)
end for
delay (50)
%increasing player speed
for count : 1 .. upper (bar)
if bar (count) > 50 then
bar (count) := bar (count) - 50
locate (1, 1)
put names (count), "s turn"
getch (key)
else
bar (count) := bar (count) + speed (count)
end if
end for
%drawing the bars
for count : 1 .. upper (bar)
drawfillbox (maxx - 50, count * 10, maxx, count * 10 + 10, yellow)
drawfillbox (maxx + bar (count) - 50, count * 10, maxx, count * 10 + 10, black)
end for
end loop
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Delos
|
Posted: Sun Apr 18, 2004 3:09 pm Post subject: (No subject) |
|
|
Interesting...not quite sure I understand exactly what is going on though. |
|
|
|
|
|
Tony
|
Posted: Sun Apr 18, 2004 4:10 pm Post subject: (No subject) |
|
|
some RPGs employ such battle order where each character has his/her own timer for which they must wait before making another turn. This way certain characters can attack more often then others
not much of an engine so far though... too much is hardcoded |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
gamer
|
Posted: Sun Apr 18, 2004 4:33 pm Post subject: (No subject) |
|
|
oic....dats pretty good
btw omni, ar u plannin to incorporate this into ur bird-eye-view shooter game?? |
|
|
|
|
|
Delos
|
Posted: Sun Apr 18, 2004 5:04 pm Post subject: (No subject) |
|
|
Ah, Timers...so that's what they are supposed to be...they did vaguely remind me of FF7...which is odd since I'm playing it right now...well, not at this very moment...sadly... |
|
|
|
|
|
guruguru
|
Posted: Sun Apr 18, 2004 7:22 pm Post subject: (No subject) |
|
|
omni (Jeffery Liu) are u Geoffrey Lui by any chance? Do you know, of many people, Ms. Gauthier? |
|
|
|
|
|
omni
|
Posted: Mon Apr 19, 2004 11:33 am Post subject: (No subject) |
|
|
gamer: no, I don't see the point of putting that system in my shooting game
gururu: NO, I have no idea who geoffry lui is Just because I have the same last name as somebody who is also chinese, doesn't mean we are related.
tony: what do you mean by hardcoded? Do you mean that I use too many constant values instead of variables? |
|
|
|
|
|
Delos
|
Posted: Mon Apr 19, 2004 11:56 am Post subject: (No subject) |
|
|
Hardcoded just means that you made it for that particular screen, with those particular colours, names, speeds, etc etc etc. Were it not so, you could package it up and dump it into any programme you so desired and it would work well without disrupting anything else.
So, basically, too many constants almost= hardcoded.
Think of it as a prog that finds multiples of 5. You could always hardcode it so that any number entered will be compared with its reference within the prog, then the answer displayed; or you could use a bunch of vars and formulae instead. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
|
|