I really need some help with my code. I need to somehow make the goblin's health bar decrease when the goblin is touched by the player's sword, now I can do this.. but the only way I can think of is to draw the goblin's health bar with the x2 of the health bar a little less again and again and again, with delays in between until x2 reaches the same amount as x1. I could do that, but it would take forever. Also.. if the end of the player's sword toches the goblin even without pressing the attack button, the goblin will still lose health, because the sword does not have to be drawn for it to still equal the same x, x2, y, and y2 values. I have no clue where to begin. Please.. someone help, I am a novice in programming and I can't figure this out.
Please read my code to understand what I'm talking about...
All my code:
Turing: |
% --------------------------
%|Wanderer of the Dark Realm|
%| By Spencer Sherman |
% --------------------------
var font : int
var font2 : int
var keys : array char of boolean
% ----------------------------------
%|Player Move/Attack/Health Position|
% ----------------------------------
var plmov : int := 0
var platt : int := 0
var plhel : int := 0
% -----------------------
%|Player X/Y/Height/Width|
% -----------------------
var plx := 50
var ply := 0
var plx2 := 70
var ply2 := 20
% ----------------------
%|Gobin X/Y/Width/Height|
% ----------------------
var gobx := 5
var goby := 5
var gobx2 := 5
var goby2 := 5
% -------------
%|Screen Config|
% -------------
setscreen ("offscreenonly")
setscreen ("graphics:1024;768")
% -----
%|Fonts|
% -----
font := Font.New ("arial:10:bold,italic")
font2 := Font.New ("arial:10:bold")
% -------------------
%|Draw Map 1 Goblin 1|
% -------------------
procedure DrawMap1Goblin1
% ----
%|Body|
% ----
Draw.FillBox (gobx + 45, goby + 195, gobx2 + 65, goby2 + 210, brown)
Draw.Box (gobx + 45, goby + 195, gobx2 + 65, goby2 + 210, black)
% ----
%|Head|
% ----
Draw.FillBox (gobx + 50, goby + 200, gobx2 + 60, goby2 + 210, green)
Draw.Box (gobx + 50, goby + 200, gobx2 + 60, goby2 + 210, black)
% --------
%|Left Ear|
% --------
Draw.FillBox (gobx + 45, goby + 205, gobx2 + 50, goby2 + 215, green)
Draw.Box (gobx + 45, goby + 205, gobx2 + 50, goby2 + 215, black)
% ---------
%|Right Ear|
% ---------
Draw.FillBox (gobx + 60, goby + 205, gobx2 + 65, goby2 + 215, green)
Draw.Box (gobx + 60, goby + 205, gobx2 + 65, goby2 + 215, black)
% --------
%|Left Arm|
% --------
Draw.FillBox (gobx + 40, goby + 190, gobx2 + 45, goby2 + 205, green)
Draw.Box (gobx + 40, goby + 190, gobx2 + 45, goby2 + 205, black)
Draw.FillBox (gobx + 40, goby + 190, gobx2 + 45, goby2 + 195, brown)
Draw.Box (gobx + 40, goby + 190, gobx2 + 45, goby2 + 195, black)
Draw.Line (gobx + 43, goby + 190, gobx2 + 43, goby2 + 193, black)
% ---------
%|Right Arm|
% ---------
Draw.FillBox (gobx + 65, goby + 190, gobx2 + 70, goby2 + 205, green)
Draw.Box (gobx + 65, goby + 190, gobx2 + 70, goby2 + 205, black)
Draw.FillBox (gobx + 65, goby + 190, gobx2 + 70, goby2 + 195, brown)
Draw.Box (gobx + 65, goby + 190, gobx2 + 70, goby2 + 195, black)
Draw.Line (gobx + 67, goby + 190, gobx2 + 67, goby2 + 193, black)
% ---------
%|Left Foot|
% ---------
Draw.FillBox (gobx + 48, goby + 190, gobx2 + 53, goby2 + 195, green)
Draw.Box (gobx + 48, goby + 190, gobx2 + 53, goby2 + 195, black)
% ----------
%|Right Foot|
% ----------
Draw.FillBox (gobx + 58, goby + 190, gobx2 + 63, goby2 + 195, green)
Draw.Box (gobx + 58, goby + 190, gobx2 + 63, goby2 + 195, black)
end DrawMap1Goblin1
% ------------------------------
%|Map 1 Goblin 1 Health Bar Full|
% ------------------------------
procedure DrawMap1Goblin1Health
Draw.FillBox (gobx + 40, goby + 220, gobx2 + 70, goby2 + 230, 12)
Draw.Box (gobx + 40, goby + 220, gobx2 + 70, goby2 + 230, black)
end DrawMap1Goblin1Health
% -----------------
%|Player Procedures|
% -----------------
% -------------------------
%|Draw Player Health Bar Up|
% -------------------------
procedure DrawPlayerHealthUp
Draw.FillBox (plx - 10, ply - 10, plx2 + 10, ply2 - 40, 12)
Draw.Box (plx - 10, ply - 10, plx2 + 10, ply2 - 40, white)
end DrawPlayerHealthUp
% ---------------------------
%|Draw Player Health Bar Down|
% ---------------------------
procedure DrawPlayerHealthDown
Draw.FillBox (plx - 10, ply + 30, plx2 + 10, ply2 + 20, 12)
Draw.Box (plx - 10, ply + 30, plx2 + 10, ply2 + 20, white)
end DrawPlayerHealthDown
% --------------------------
%|Draw Player Health Bar Left|
% --------------------------
procedure DrawPlayerHealthLeft
Draw.FillBox (plx + 30, ply - 10, plx2 + 20, ply2 + 10, 12)
Draw.Box (plx + 30, ply - 10, plx2 + 20, ply2 + 10, white)
end DrawPlayerHealthLeft
% ----------------------------
%|Draw Player Health Bar Right|
% ----------------------------
procedure DrawPlayerHealthRight
Draw.FillBox (plx - 10, ply - 10, plx2 - 40, ply2 + 10, 12)
Draw.Box (plx - 10, ply - 10, plx2 - 40, ply2 + 10, white)
end DrawPlayerHealthRight
% --------------
%|Draw Player Up|
% --------------
procedure PlayerMoveUp
% ----
%|Helm|
% ----
Draw.FillBox (plx, ply, plx2, ply2, grey)
Draw.Box (plx, ply, plx2, ply2, black)
% ---------
%|Left Foot|
% ---------
Draw.FillBox (plx + 4, ply + 20, plx2 - 11, ply2 + 5, grey)
Draw.Box (plx + 4, ply + 20, plx2 - 11, ply2 + 5, black)
% ---------
%|Right Foot|
% ---------
Draw.FillBox (plx + 11, ply + 20, plx2 - 4, ply2 + 5, grey)
Draw.Box (plx + 11, ply + 20, plx2 - 4, ply2 + 5, black)
% --------
%|Left Arm|
% --------
Draw.FillBox (plx - 5, ply + 2, plx2 - 20, ply2 + 10, grey)
Draw.Box (plx - 5, ply + 2, plx2 - 20, ply2 + 10, black)
Draw.Line (plx - 5, ply + 25, plx2 - 20, ply2 + 5, black)
% ---------
%|Right Arm|
% ---------
Draw.FillBox (plx + 20, ply + 2, plx2 + 5, ply2 + 10, grey)
Draw.Box (plx + 20, ply + 2, plx2 + 5, ply2 + 10, black)
Draw.Line (plx + 20, ply + 25, plx2 + 5, ply2 + 5, black)
% --------------
%|Helm Left Horn|
% --------------
Draw.Line (plx, ply, plx2 - 20, ply2, black)
Draw.FillBox (plx - 10, ply + 6, plx2 - 25, ply2 - 6, brown)
Draw.Box (plx - 10, ply + 6, plx2 - 25, ply2 - 6, black)
Draw.FillBox (plx - 13, ply + 8, plx2 - 30, ply2 - 8, brown)
Draw.Box (plx - 13, ply + 8, plx2 - 30, ply2 - 8, black)
Draw.Box (plx, ply, plx2, ply2, black)
Draw.FillBox (plx - 5, ply + 5, plx2 - 15, ply2 - 5, brown)
Draw.Box (plx - 5, ply + 5, plx2 - 15, ply2 - 5, black)
Draw.Line (plx, ply, plx2 - 20, ply2, black)
% ---------------
%|Helm Right Horn|
% ---------------
Draw.Line (plx + 20, ply, plx2, ply2, black)
Draw.FillBox (plx + 25, ply + 6, plx2 + 10, ply2 - 6, brown)
Draw.Box (plx + 25, ply + 6, plx2 + 10, ply2 - 6, black)
Draw.FillBox (plx + 30, ply + 8, plx2 + 13, ply2 - 8, brown)
Draw.Box (plx + 30, ply + 8, plx2 + 13, ply2 - 8, black)
Draw.Box (plx, ply, plx2, ply2, black)
Draw.FillBox (plx + 15, ply + 5, plx2 + 5, ply2 - 5, brown)
Draw.Box (plx + 15, ply + 5, plx2 + 5, ply2 - 5, black)
Draw.Line (plx + 20, ply, plx2, ply2, black)
end PlayerMoveUp
% ----------------
%|Draw Player Down|
% ----------------
procedure PlayerMoveDown
% ----
%|Helm|
% ----
Draw.FillBox (plx, ply, plx2, ply2, grey)
Draw.Box (plx, ply, plx2, ply2, black)
% ---------
%|Left Foot|
% ---------
Draw.FillBox (plx + 4, ply - 5, plx2 - 11, ply2 - 20, grey)
Draw.Box (plx + 4, ply - 5, plx2 - 11, ply2 - 20, black)
% ---------
%|Right Foot|
% ---------
Draw.FillBox (plx + 11, ply - 5, plx2 - 4, ply2 - 20, grey)
Draw.Box (plx + 11, ply - 5, plx2 - 4, ply2 - 20, black)
% --------
%|Left Arm|
% --------
Draw.FillBox (plx - 5, ply - 10, plx2 - 20, ply2 - 2, grey)
Draw.Box (plx - 5, ply - 10, plx2 - 20, ply2 - 2, black)
Draw.Line (plx - 5, ply - 5, plx2 - 20, ply2 - 25, black)
% ---------
%|Right Arm|
% ---------
Draw.FillBox (plx + 20, ply - 10, plx2 + 5, ply2 - 2, grey)
Draw.Box (plx + 20, ply - 10, plx2 + 5, ply2 - 2, black)
Draw.Line (plx + 20, ply - 5, plx2 + 5, ply2 - 25, black)
% --------------
%|Helm Left Horn|
% --------------
Draw.Line (plx, ply, plx2 - 20, ply2, black)
Draw.FillBox (plx - 10, ply + 6, plx2 - 25, ply2 - 6, brown)
Draw.Box (plx - 10, ply + 6, plx2 - 25, ply2 - 6, black)
Draw.FillBox (plx - 13, ply + 8, plx2 - 30, ply2 - 8, brown)
Draw.Box (plx - 13, ply + 8, plx2 - 30, ply2 - 8, black)
Draw.Box (plx, ply, plx2, ply2, black)
Draw.FillBox (plx - 5, ply + 5, plx2 - 15, ply2 - 5, brown)
Draw.Box (plx - 5, ply + 5, plx2 - 15, ply2 - 5, black)
Draw.Line (plx, ply, plx2 - 20, ply2, black)
% ---------------
%|Helm Right Horn|
% ---------------
Draw.Line (plx + 20, ply, plx2, ply2, black)
Draw.FillBox (plx + 25, ply + 6, plx2 + 10, ply2 - 6, brown)
Draw.Box (plx + 25, ply + 6, plx2 + 10, ply2 - 6, black)
Draw.FillBox (plx + 30, ply + 8, plx2 + 13, ply2 - 8, brown)
Draw.Box (plx + 30, ply + 8, plx2 + 13, ply2 - 8, black)
Draw.Box (plx, ply, plx2, ply2, black)
Draw.FillBox (plx + 15, ply + 5, plx2 + 5, ply2 - 5, brown)
Draw.Box (plx + 15, ply + 5, plx2 + 5, ply2 - 5, black)
Draw.Line (plx + 20, ply, plx2, ply2, black)
end PlayerMoveDown
% -----------------
%|Draw Player Right|
% -----------------
procedure PlayerMoveRight
% ----
%|Helm|
% ----
Draw.FillBox (plx, ply, plx2, ply2, grey)
Draw.Box (plx, ply, plx2, ply2, black)
% ---------
%|Left Foot|
% ---------
Draw.FillBox (plx + 20, ply + 4, plx2 + 5, ply2 - 11, grey)
Draw.Box (plx + 20, ply + 4, plx2 + 5, ply2 - 11, black)
% ---------
%|Right Foot|
% ---------
Draw.FillBox (plx + 20, ply + 11, plx2 + 5, ply2 - 4, grey)
Draw.Box (plx + 20, ply + 11, plx2 + 5, ply2 - 4, black)
% --------
%|Left Arm|
% --------
Draw.FillBox (plx + 2, ply + 20, plx2 + 10, ply2 + 5, grey)
Draw.Box (plx + 2, ply + 20, plx2 + 10, ply2 + 5, black)
Draw.Line (plx + 25, ply + 20, plx2 + 5, ply2 + 5, black)
% ---------
%|Right Arm|
% ---------
Draw.FillBox (plx + 2, ply - 5, plx2 + 10, ply2 - 20, grey)
Draw.Box (plx + 2, ply - 5, plx2 + 10, ply2 - 20, black)
Draw.Line (plx + 25, ply - 5, plx2 + 5, ply2 - 20, black)
% --------------
%|Helm Left Horn|
% --------------
Draw.Line (plx, ply, plx2, ply2 - 20, black)
Draw.FillBox (plx + 6, ply - 10, plx2 - 6, ply2 - 25, brown)
Draw.Box (plx + 6, ply - 10, plx2 - 6, ply2 - 25, black)
Draw.FillBox (plx + 8, ply - 13, plx2 - 8, ply2 - 30, brown)
Draw.Box (plx + 8, ply - 13, plx2 - 8, ply2 - 30, black)
Draw.Box (plx, ply, plx2, ply2, black)
Draw.FillBox (plx + 5, ply - 5, plx2 - 5, ply2 - 15, brown)
Draw.Box (plx + 5, ply - 5, plx2 - 5, ply2 - 15, black)
Draw.Line (plx, ply, plx2, ply2 - 20, black)
% ---------------
%|Helm Right Horn|
% ---------------
Draw.Line (plx, ply + 20, plx2, ply2, black)
Draw.FillBox (plx + 6, ply + 25, plx2 - 6, ply2 + 10, brown)
Draw.Box (plx + 6, ply + 25, plx2 - 6, ply2 + 10, black)
Draw.FillBox (plx + 8, ply + 30, plx2 - 8, ply2 + 13, brown)
Draw.Box (plx + 8, ply + 30, plx2 - 8, ply2 + 13, black)
Draw.Box (plx, ply, plx2, ply2, black)
Draw.FillBox (plx + 5, ply + 15, plx2 - 5, ply2 + 5, brown)
Draw.Box (plx + 5, ply + 15, plx2 - 5, ply2 + 5, black)
Draw.Line (plx, ply + 20, plx2, ply2, black)
end PlayerMoveRight
% ----------------
%|Draw Player Left|
% ----------------
procedure PlayerMoveLeft
% ----
%|Helm|
% ----
Draw.FillBox (plx, ply, plx2, ply2, grey)
Draw.Box (plx, ply, plx2, ply2, black)
% ----------
%|Right Foot|
% ----------
Draw.FillBox (plx - 5, ply + 11, plx2 - 20, ply2 - 4, grey)
Draw.Box (plx - 5, ply + 11, plx2 - 20, ply2 - 4, black)
% ---------
%|Left Foot|
% ---------
Draw.FillBox (plx - 5, ply + 4, plx2 - 20, ply2 - 11, grey)
Draw.Box (plx - 5, ply + 4, plx2 - 20, ply2 - 11, black)
% ---------
%|Right Arm|
% ---------
Draw.FillBox (plx - 10, ply - 5, plx2 - 2, ply2 - 20, grey)
Draw.Box (plx - 10, ply - 5, plx2 - 2, ply2 - 20, black)
Draw.Line (plx - 5, ply - 5, plx2 - 25, ply2 - 20, black)
% ---------
%|Left Arm|
% ---------
Draw.FillBox (plx - 10, ply + 20, plx2 - 2, ply2 + 5, grey)
Draw.Box (plx - 10, ply + 20, plx2 - 2, ply2 + 5, black)
Draw.Line (plx - 5, ply + 20, plx2 - 25, ply2 + 5, black)
% ---------------
%|Helm Right Horn|
% ---------------
Draw.Line (plx, ply, plx2, ply2 - 20, black)
Draw.FillBox (plx + 6, ply - 10, plx2 - 6, ply2 - 25, brown)
Draw.Box (plx + 6, ply - 10, plx2 - 6, ply2 - 25, black)
Draw.FillBox (plx + 8, ply - 13, plx2 - 8, ply2 - 30, brown)
Draw.Box (plx + 8, ply - 13, plx2 - 8, ply2 - 30, black)
Draw.Box (plx, ply, plx2, ply2, black)
Draw.FillBox (plx + 5, ply - 5, plx2 - 5, ply2 - 15, brown)
Draw.Box (plx + 5, ply - 5, plx2 - 5, ply2 - 15, black)
Draw.Line (plx, ply, plx2, ply2 - 20, black)
% ---------------
%|Left Right Horn|
% ---------------
Draw.Line (plx, ply + 20, plx2, ply2, black)
Draw.FillBox (plx + 6, ply + 25, plx2 - 6, ply2 + 10, brown)
Draw.Box (plx + 6, ply + 25, plx2 - 6, ply2 + 10, black)
Draw.FillBox (plx + 8, ply + 30, plx2 - 8, ply2 + 13, brown)
Draw.Box (plx + 8, ply + 30, plx2 - 8, ply2 + 13, black)
Draw.Box (plx, ply, plx2, ply2, black)
Draw.FillBox (plx + 5, ply + 15, plx2 - 5, ply2 + 5, brown)
Draw.Box (plx + 5, ply + 15, plx2 - 5, ply2 + 5, black)
Draw.Line (plx, ply + 20, plx2, ply2, black)
end PlayerMoveLeft
%----------------------
%|Draw Player Attack Up|
% ---------------------
procedure PlayerAttackUp
if keys ('a') then
% -----
%|Sword|
% -----
Draw.FillBox (plx + 20, ply + 40, plx2 + 5, ply2 + 55, grey)
Draw.Box (plx + 20, ply + 40, plx2 + 5, ply2 + 55, black)
Draw.Line (plx + 22, ply + 40, plx2 + 2, ply2 + 55, black)
Draw.Line (plx + 23, ply + 40, plx2 + 3, ply2 + 55, black)
% ------------
%|Sword Handle|
% ------------
Draw.FillBox (plx + 20, ply + 30, plx2 + 5, ply2 + 15, brown)
Draw.Box (plx + 20, ply + 30, plx2 + 5, ply2 + 15, black)
Draw.FillBox (plx + 15, ply + 35, plx2 + 10, ply2 + 20, brown)
Draw.Box (plx + 15, ply + 35, plx2 + 10, ply2 + 20, black)
Draw.FillBox (plx + 20, ply + 35, plx2 + 5, ply2 + 20, yellow)
Draw.Box (plx + 20, ply + 35, plx2 + 5, ply2 + 20, black)
end if
end PlayerAttackUp
% -----------------------
%|Draw Player Attack Down|
% -----------------------
procedure PlayerAttackDown
if keys ('a') then
% -----
%|Sword|
% -----
Draw.FillBox (plx - 5, ply - 55, plx2 - 20, ply2 - 40, grey)
Draw.Box (plx - 5, ply - 55, plx2 - 20, ply2 - 40, black)
Draw.Line (plx - 3, ply - 55, plx2 - 23, ply2 - 40, black)
Draw.Line (plx - 2, ply - 55, plx2 - 22, ply2 - 40, black)
% ------------
%|Sword Handle|
% ------------
Draw.FillBox (plx - 5, ply - 15, plx2 - 20, ply2 - 30, brown)
Draw.Box (plx - 5, ply - 15, plx2 - 20, ply2 - 30, black)
Draw.FillBox (plx - 10, ply - 20, plx2 - 15, ply2 - 35, brown)
Draw.Box (plx - 10, ply - 20, plx2 - 15, ply2 - 35, black)
Draw.FillBox (plx - 5, ply - 20, plx2 - 20, ply2 - 35, yellow)
Draw.Box (plx - 5, ply - 20, plx2 - 20, ply2 - 35, black)
end if
end PlayerAttackDown
% ------------------------
%|Draw Player Attack Right|
% ------------------------
procedure PlayerAttackRight
if keys ('a') then
% -----
%|Sword|
% -----
Draw.FillBox (plx + 40, ply - 5, plx2 + 55, ply2 - 20, grey)
Draw.Box (plx + 40, ply - 5, plx2 + 55, ply2 - 20, black)
Draw.Line (plx + 40, ply - 2, plx2 + 55, ply2 - 23, black)
Draw.Line (plx + 40, ply - 3, plx2 + 55, ply2 - 22, black)
% ------------
%|Sword Handle|
% ------------
Draw.FillBox (plx + 30, ply - 5, plx2 + 15, ply2 - 20, brown)
Draw.Box (plx + 30, ply - 5, plx2 + 15, ply2 - 20, black)
Draw.FillBox (plx + 35, ply - 10, plx2 + 20, ply2 - 15, brown)
Draw.Box (plx + 35, ply - 10, plx2 + 20, ply2 - 15, black)
Draw.FillBox (plx + 35, ply - 5, plx2 + 20, ply2 - 20, yellow)
Draw.Box (plx + 35, ply - 5, plx2 + 20, ply2 - 20, black)
end if
end PlayerAttackRight
% -----------------------
%|Draw Player Attack Left|
% -----------------------
procedure PlayerAttackLeft
if keys ('a') then
% -----
%|Sword|
% -----
Draw.FillBox (plx - 55, ply + 20, plx2 - 40, ply2 + 5, grey)
Draw.Box (plx - 55, ply + 20, plx2 - 40, ply2 + 5, black)
Draw.Line (plx - 55, ply + 23, plx2 - 40, ply2 + 2, black)
Draw.Line (plx - 55, ply + 22, plx2 - 40, ply2 + 3, black)
% ------------
%|Sword Handle|
% ------------
Draw.FillBox (plx - 15, ply + 20, plx2 - 30, ply2 + 5, brown)
Draw.Box (plx - 15, ply + 20, plx2 - 30, ply2 + 5, black)
Draw.FillBox (plx - 20, ply + 15, plx2 - 35, ply2 + 10, brown)
Draw.Box (plx - 20, ply + 15, plx2 - 35, ply2 + 10, black)
Draw.FillBox (plx - 20, ply + 20, plx2 - 35, ply2 + 5, yellow)
Draw.Box (plx - 20, ply + 20, plx2 - 35, ply2 + 5, black)
end if
end PlayerAttackLeft
% --------------
%|Map Procedures|
% --------------
% ----------
%|Draw Map 1|
% ----------
procedure DrawMap1
% -----
%}Floor|
% -----
colorback (25)
% -----
%|Walls|
% -----
Draw.FillBox (0, 0, 25, 768, black)
Draw.FillBox (0, 0, 1024, 25, black)
Draw.FillBox (0, 743, 1024, 768, black)
Draw.FillBox (999, 0, 1024, 768, black)
Draw.FillBox (100, 0, 125, 400, black)
Draw.FillBox (125, 375, 400, 400, black)
Draw.FillBox (401, 100, 426, 400, black)
Draw.FillBox (401, 100, 600, 125, black)
Draw.FillBox (601, 100, 626, 525, black)
Draw.FillBox (627, 500, 923, 525, black)
% --------
%|Entrance|
% --------
Draw.FillBox (26, 0, 99, 25, brown)
Draw.Box (26, 1, 99, 25, black)
% ----
%|Exit|
% ----
Draw.FillBox (999, 667, 1024, 742, brown)
Draw.Box (999, 667, 1023, 742, black)
end DrawMap1
% ----------
%|Begin Game|
% ----------
loop
% ----------
%|Draw Map 1|
% ----------
DrawMap1
% ------------------
%|Draw Map 1 Enemies|
% ------------------
DrawMap1Goblin1
DrawMap1Goblin1Health
% ------------------------
%|Player Movement & Attack|
% ------------------------
Input.KeyDown (keys )
if keys (KEY_UP_ARROW) then
ply + = 1
ply2 + = 1
DrawPlayerHealthUp
PlayerMoveUp
PlayerAttackUp
plmov := 0
platt := 0
plhel := 0
end if
if plhel = 0 then
DrawPlayerHealthUp
end if
if plmov = 0 then
PlayerMoveUp
end if
if platt = 0 then
PlayerAttackUp
end if
if keys (KEY_DOWN_ARROW) then
ply - = 1
ply2 - = 1
PlayerMoveDown
PlayerAttackDown
plmov := 1
platt := 1
plhel := 1
end if
if plhel = 1 then
DrawPlayerHealthDown
end if
if plmov = 1 then
PlayerMoveDown
end if
if platt = 1 then
PlayerAttackDown
end if
if keys (KEY_RIGHT_ARROW) then
plx + = 1
plx2 + = 1
PlayerMoveRight
PlayerAttackRight
plmov := 2
platt := 2
plhel := 2
end if
if plhel = 2 then
DrawPlayerHealthRight
end if
if plmov = 2 then
PlayerMoveRight
end if
if platt = 2 then
PlayerAttackRight
end if
if keys (KEY_LEFT_ARROW) then
plx - = 1
plx2 - = 1
PlayerMoveLeft
PlayerAttackLeft
plmov := 3
platt := 3
plhel := 3
end if
if plhel = 3 then
DrawPlayerHealthLeft
end if
if plmov = 3 then
PlayerMoveLeft
end if
if platt = 3 then
PlayerAttackLeft
end if
% -------------------------
%|Player VS. Map 1 Goblin 1|
% -------------------------
View.Update
delay (5)
cls
end loop
|
|