Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Game Attack Key
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Spence607




PostPosted: Mon Jan 12, 2009 1:18 pm   Post subject: Game Attack Key

Yes, I have an older topic of this same problem, check it out here. But... ever since I changed my code this solution will not work, I would really appreciate it if someone could figure out why, I have tried everything.. nothing works, I'm starting to go insane actually, this game is due next Monday.

Turing:

% ------------------
%|  The Chosen One  |
%|By Spencer Sherman|
% ------------------
var smalltext : int
var maptext : int
var floortext : int
var largetext : int
var nametext : int
var keys : array char of boolean
% ----------------------------------
%|Player Move/Attack/Health Position|
% ----------------------------------
var move := 0
var attack := 0
var plhel := 53
var plhelb := 53
var plattb := 47
var pldefb := 46
var defenseval : string := "16"
var attackval : string := "17"
var healthval : string := "23"
var attacked : boolean := false
var pexp : string := "0"
var pexpn : string := "800"
var plvl : string := "1"
var prank : string := "Goblin Slayer"
var plflo : string := "1"
var currentweapon := 0
var currenthelm := 0
var currentarmor := 0
var Track1 : boolean := false
var Track2 : boolean := false
var Track3 : boolean := false
var Track4 : boolean := false
var Track5 : boolean := false
var Track6 : boolean := false
var Track7 : boolean := false
var Track8 : boolean := false
% -----------------------
%|Player X/Y/Height/Width|
% -----------------------
var plx := 440
var ply := 50
% -----------------------
%|Map 1 Goblin 1 Variable|
% -----------------------
var mgobx := 500
var mgoby := 500
var mgobhealth := 55
% -------------
%|Screen Config|
% -------------
setscreen ("offscreenonly")
setscreen ("graphics:1024;768")
% -----
%|Fonts|
% -----
smalltext := Font.New ("arial:8:bold")
maptext := Font.New ("times new roman:30:bold, italic")
floortext := Font.New ("arial:15:bold, italic")
largetext := Font.New ("times new roman:18:italic")
nametext := Font.New ("arial:12:bold")
% -----
%|Music|
% -----
%Tracks
process DarkNight
    loop
        Music.PlayFile ("Dark Night.mp3")
    end loop
end DarkNight
process EpicBattle
    loop
        Music.PlayFile ("Epic Battle.mp3")
    end loop
end EpicBattle
process GatesofEden
    loop
        Music.PlayFile ("Gates of Eden.mp3")
    end loop
end GatesofEden
process GodsofThunder
    loop
        Music.PlayFile ("Gods of Thunder.mp3")
    end loop
end GodsofThunder
process Premonition
    loop
        Music.PlayFile ("Premonition.mp3")
    end loop
end Premonition
process Regression
    loop
        Music.PlayFile ("Regression.mp3")
    end loop
end Regression
process TheRockofWar
    loop
        Music.PlayFile ("The Rock of War.mp3")
    end loop
end TheRockofWar
process Tripwire
    loop
        Music.PlayFile ("Tripwire.mp3")
    end loop
end Tripwire
%Sound Effects
process Sword
    Music.PlayFile ("Sword.wav")
end Sword
process Flesh
    Music.PlayFile ("Flesh.wav")
end Flesh
process Goblin
    Music.PlayFile ("Goblin.wav")
end Goblin
% ---------
%|Inventory|
% ---------
%Weapons
procedure RydensDemise
    %Text
    Draw.Text ("Ryden's Demise", 705, 285, smalltext, yellow)
    Draw.Text ("ATT: 12", 715, 271, smalltext, grey)
    Draw.Text ("HP: 3", 759, 271, smalltext, grey)
    %Blade
    var bladex : array 1 .. 3 of int := init (743, 750, 757)
    var bladey : array 1 .. 3 of int := init (250, 262, 250)
    Draw.FillPolygon (bladex, bladey, 3, grey)
    Draw.FillBox (743, 85, 757, 250, grey)
    %Handle
    Draw.Line (750, 85, 750, 262, black)
    Draw.FillBox (728, 70, 772, 84, 24)
    Draw.Line (728, 70, 742, 84, black)
    Draw.Line (758, 84, 772, 70, black)
    Draw.FillBox (743, 70, 757, 84, 44)
    Draw.Box (742, 69, 758, 85, black)
    Draw.Line (742, 69, 758, 85, black)
    Draw.Line (742, 85, 758, 69, black)
    Draw.FillBox (743, 33, 757, 68, brown)
    Draw.Line (743, 41, 757, 41, black)
    Draw.Line (743, 43, 757, 43, black)
    Draw.Line (743, 45, 757, 45, black)
    Draw.Line (743, 47, 757, 47, black)
    Draw.Line (743, 49, 757, 49, black)
    Draw.Line (743, 51, 757, 51, black)
    Draw.Line (743, 53, 757, 53, black)
    Draw.Line (743, 55, 757, 55, black)
    Draw.Line (743, 57, 757, 57, black)
    Draw.Line (743, 59, 757, 59, black)
    Draw.Line (743, 61, 757, 61, black)
    Draw.Line (743, 63, 757, 63, black)
    Draw.Line (743, 65, 757, 65, black)
    Draw.Line (743, 67, 757, 67, black)
end RydensDemise
%Helms
procedure HornedHelm
    %Text
    Draw.Text ("Horned Helm", 825, 285, smalltext, white)
    Draw.Text ("DEF: 3", 845, 270, smalltext, grey)
    %Helm
    Draw.FillBox (835, 198, 847, 239, grey)
    Draw.Line (835, 210, 847, 210, black)
    Draw.FillBox (873, 198, 885, 239, grey)
    Draw.Line (873, 210, 885, 210, black)
    Draw.FillBox (847, 231, 873, 251, grey)
    Draw.Box (847, 230, 873, 252, black)
    Draw.Line (847, 231, 873, 251, black)
    Draw.Line (847, 251, 873, 231, black)
    Draw.FillBox (848, 198, 872, 230, 20)
    %Left Horn
    Draw.FillBox (841, 241, 846, 251, brown)
    Draw.Line (841, 241, 841, 251, black)
    Draw.FillBox (835, 244, 840, 254, brown)
    Draw.Line (835, 244, 835, 254, black)
    Draw.FillBox (829, 247, 834, 257, brown)
    Draw.Line (829, 247, 829, 257, black)
    Draw.FillBox (823, 252, 828, 262, brown)
    %Right Horn
    Draw.FillBox (892, 252, 897, 262, brown)
    Draw.FillBox (886, 247, 891, 257, brown)
    Draw.Line (891, 247, 891, 257, black)
    Draw.FillBox (880, 244, 885, 254, brown)
    Draw.Line (885, 244, 885, 254, black)
    Draw.FillBox (874, 241, 879, 251, brown)
    Draw.Line (879, 241, 879, 251, black)
end HornedHelm
%Armors
procedure SteelPlate
    %Text
    Draw.Text ("Steel Plate", 831, 180, smalltext, white)
    Draw.Text ("DEF: 8", 845, 165, smalltext, grey)
    %Left Shoulder
    Draw.FillBox (803, 120, 845, 157, grey)
    Draw.Box (803, 120, 845, 157, black)
    Draw.Line (803, 120, 845, 157, black)
    Draw.Line (803, 157, 845, 120, black)
    %Right Shoulder
    Draw.FillBox (875, 120, 917, 157, grey)
    Draw.Box (875, 120, 917, 157, black)
    Draw.Line (875, 120, 917, 157, black)
    Draw.Line (875, 157, 917, 120, black)
    %Upper Body
    Draw.FillBox (813, 70, 907, 119, grey)
    Draw.FillBox (846, 120, 874, 125, 20)
    Draw.Box (813, 70, 907, 119, black)
    Draw.Line (859, 70, 859, 119, black)
    Draw.Line (861, 70, 861, 119, black)
    %Lower Body
    Draw.FillBox (818, 23, 902, 69, grey)
    Draw.Box (818, 23, 902, 69, black)
    Draw.Line (818, 50, 902, 50, black)
end SteelPlate
% ---------
%|Equipment|
% ---------
%Weapons
procedure RydensDemiseEquip
    %Blade
    Draw.FillBox (plx + 21, ply + 37, plx + 25, ply + 77, grey)
    Draw.Box (plx + 21, ply + 37, plx + 25, ply + 77, black)
    Draw.Line (plx + 23, ply + 37, plx + 23, ply + 77, black)
    %Handle
    Draw.FillBox (plx + 21, ply + 28, plx + 25, ply + 33, brown)
    Draw.Box (plx + 21, ply + 28, plx + 25, ply + 33, black)
    Draw.Line (plx + 21, ply + 30, plx + 25, ply + 30, black)
    Draw.Line (plx + 21, ply + 32, plx + 25, ply + 32, black)
    Draw.FillBox (plx + 17, ply + 33, plx + 29, ply + 37, 24)
    Draw.Box (plx + 17, ply + 33, plx + 29, ply + 37, black)
    Draw.Line (plx + 17, ply + 33, plx + 21, ply + 37, black)
    Draw.Line (plx + 25, ply + 37, plx + 29, ply + 33, black)
    Draw.FillBox (plx + 21, ply + 33, plx + 25, ply + 37, yellow)
    Draw.Box (plx + 21, ply + 33, plx + 25, ply + 37, black)
    Draw.Line (plx + 21, ply + 33, plx + 25, ply + 37, black)
    Draw.Line (plx + 21, ply + 37, plx + 25, ply + 33, black)
end RydensDemiseEquip
%Helms
procedure HornedHelmEquip
    %Head
    Draw.FillBox (plx + 5, ply + 8, plx + 15, ply + 18, grey)
    Draw.Box (plx + 5, ply + 8, plx + 15, ply + 18, black)
    Draw.Box (plx + 8, ply + 8, plx + 12, ply + 18, black)
    %Left Horn
    Draw.FillBox (plx, ply + 11, plx + 8, ply + 15, brown)
    Draw.Box (plx, ply + 11, plx + 8, ply + 15, black)
    Draw.Line (plx + 2, ply + 11, plx + 2, ply + 15, black)
    Draw.Line (plx + 4, ply + 11, plx + 4, ply + 15, black)
    Draw.Line (plx + 6, ply + 11, plx + 6, ply + 15, black)
    %Right Horn
    Draw.FillBox (plx + 12, ply + 11, plx + 20, ply + 15, brown)
    Draw.Box (plx + 12, ply + 11, plx + 20, ply + 15, black)
    Draw.Line (plx + 14, ply + 11, plx + 14, ply + 15, black)
    Draw.Line (plx + 16, ply + 11, plx + 16, ply + 15, black)
    Draw.Line (plx + 18, ply + 11, plx + 18, ply + 15, black)
end HornedHelmEquip
%Armors
procedure SteelPlateEquip
    %Body
    Draw.FillBox (plx, ply + 10, plx + 20, ply + 20, grey)
    Draw.Box (plx, ply + 10, plx + 20, ply + 20, black)
    Draw.Line (plx + 9, ply + 10, plx + 9, ply + 20, black)
    Draw.Line (plx + 11, ply + 10, plx + 11, ply + 20, black)
    %Left Arm
    Draw.FillBox (plx - 6, ply + 11, plx, ply + 23, grey)
    Draw.Box (plx - 6, ply + 11, plx, ply + 23, black)
    Draw.Box (plx - 6, ply + 11, plx, ply + 17, black)
    Draw.Line (plx - 6, ply + 11, plx, ply + 17, black)
    Draw.Line (plx - 6, ply + 17, plx, ply + 11, black)
    Draw.Line (plx - 3, ply + 17, plx - 3, ply + 23, black)
    %Left Hand
    Draw.FillBox (plx - 6, ply + 23, plx, ply + 29, grey)
    Draw.Box (plx - 6, ply + 23, plx, ply + 29, black)
    Draw.Line (plx - 2, ply + 26, plx - 2, ply + 29, black)
    Draw.Line (plx - 5, ply + 23, plx - 5, ply + 29, black)
    %Left Foot
    Draw.FillBox (plx + 2, ply + 20, plx + 8, ply + 25, grey)
    Draw.Box (plx + 2, ply + 20, plx + 8, ply + 25, black)
    Draw.Line (plx + 2, ply + 22, plx + 8, ply + 22, black)
    Draw.Line (plx + 5, ply + 20, plx + 5, ply + 25, black)
    %Right Arm
    Draw.FillBox (plx + 20, ply + 11, plx + 26, ply + 23, grey)
    Draw.Box (plx + 20, ply + 11, plx + 26, ply + 23, black)
    Draw.Box (plx + 20, ply + 11, plx + 26, ply + 17, black)
    Draw.Line (plx + 20, ply + 11, plx + 26, ply + 17, black)
    Draw.Line (plx + 20, ply + 17, plx + 26, ply + 11, black)
    Draw.Line (plx + 23, ply + 17, plx + 23, ply + 23, black)
    %Right Hand
    Draw.FillBox (plx + 20, ply + 23, plx + 26, ply + 29, grey)
    Draw.Box (plx + 20, ply + 23, plx + 26, ply + 29, black)
    Draw.Line (plx + 22, ply + 26, plx + 22, ply + 29, black)
    Draw.Line (plx + 25, ply + 23, plx + 25, ply + 29, black)
    %Right Foot
    Draw.FillBox (plx + 12, ply + 20, plx + 18, ply + 25, grey)
    Draw.Box (plx + 12, ply + 20, plx + 18, ply + 25, black)
    Draw.Line (plx + 12, ply + 22, plx + 18, ply + 22, black)
    Draw.Line (plx + 15, ply + 20, plx + 15, ply + 25, black)
end SteelPlateEquip
% -----
%|Armor|
% -----
procedure Armor
    if currentarmor = 0 then
        SteelPlateEquip
    end if
    if currenthelm = 0 then
        HornedHelmEquip   
    end if
end Armor
% ------
%|Weapon|
% ------
procedure Weapon
    if keys ('a') then
        attacked := true
        if currentweapon = 0 then
            RydensDemiseEquip
        end if
    else
        attacked := false
    end if
end Weapon
% -------
%|Enemies|
% -------
procedure MinorGoblin
    %Body
    Draw.FillBox (mgobx, mgoby, mgobx + 20, mgoby + 10, brown)
    Draw.Box (mgobx, mgoby, mgobx + 20, mgoby + 10, black)
    Draw.Line (mgobx, mgoby, mgobx + 20, mgoby + 10, black)
    Draw.Line (mgobx, mgoby + 10, mgobx + 20, mgoby, black)
    Draw.Line (mgobx + 10, mgoby, mgobx + 10, mgoby + 2, black)
    %Head
    Draw.FillBox (mgobx + 5, mgoby + 2, mgobx + 15, mgoby + 12, green)
    Draw.Box (mgobx + 5, mgoby + 2, mgobx + 15, mgoby + 12, black)
    %Left Arm
    Draw.FillBox (mgobx - 6, mgoby + 9, mgobx, mgoby - 9, green)
    Draw.Box (mgobx - 6, mgoby + 9, mgobx, mgoby - 9, black)
    Draw.FillBox (mgobx - 6, mgoby + 9, mgobx, mgoby - 3, brown)
    Draw.Line (mgobx - 4, mgoby + 9, mgobx - 2, mgoby, black)
    Draw.Line (mgobx - 2, mgoby + 9, mgobx - 4, mgoby, black)
    Draw.Box (mgobx - 6, mgoby + 9, mgobx, mgoby - 3, black)
    Draw.Line (mgobx - 2, mgoby - 9, mgobx - 2, mgoby - 6, black)
    %Left Foot
    Draw.FillBox (mgobx + 2, mgoby, mgobx + 8, mgoby - 5, green)
    Draw.Box (mgobx + 2, mgoby, mgobx + 8, mgoby - 5, black)
    Draw.Line (mgobx + 4, mgoby - 3, mgobx + 4, mgoby - 5, black)
    Draw.Line (mgobx + 6, mgoby - 3, mgobx + 6, mgoby - 5, black)
    %Right Arm
    Draw.FillBox (mgobx + 20, mgoby + 9, mgobx + 26, mgoby - 9, green)
    Draw.Box (mgobx + 20, mgoby + 9, mgobx + 26, mgoby - 9, black)
    Draw.FillBox (mgobx + 20, mgoby + 9, mgobx + 26, mgoby - 3, brown)
    Draw.Line (mgobx + 22, mgoby + 9, mgobx + 24, mgoby, black)
    Draw.Line (mgobx + 24, mgoby + 9, mgobx + 22, mgoby, black)
    Draw.Box (mgobx + 20, mgoby + 9, mgobx + 26, mgoby - 3, black)
    Draw.Line (mgobx + 22, mgoby - 9, mgobx + 22, mgoby - 6, black)
    %Right Foot
    Draw.FillBox (mgobx + 12, mgoby, mgobx + 18, mgoby - 5, green)
    Draw.Box (mgobx + 12, mgoby, mgobx + 18, mgoby - 5, black)
    Draw.Line (mgobx + 14, mgoby - 3, mgobx + 14, mgoby - 5, black)
    Draw.Line (mgobx + 16, mgoby - 3, mgobx + 16, mgoby - 5, black)
end MinorGoblin
% ----
%|Maps|
% ----
procedure B1
    %Floor
    colorback (25)
end B1
% ----------
%|Begin Game|
% ----------
loop
    MinorGoblin
    % ---
    %|Map|
    % ---
    % ------------
    %|Minor Goblin|
    % ------------
    if plx + 25 > mgobx and plx + 21 < mgobx + 20 and ply + 77 > mgoby and attacked = true then
        mgobhealth := mgobhealth - 1
        if mgobhealth = 7 then
            mgobx := 9999
            mgoby := 9999
        end if
    end if
    B1
    % --------
    %|Movement|
    % --------
    Input.KeyDown (keys)
    if keys (KEY_UP_ARROW) and ply + 10 < maxy and ply + 10 < maxy then
        ply := ply + 1
        Armor
        Weapon
    end if
    if move = 0 then
        Armor
    end if
    if attack = 0 then
        Weapon
    end if
    if keys (KEY_DOWN_ARROW) and ply - 10 > 0 then
        ply := ply - 1
        Armor
        Weapon
    end if
    if move = 0 then
        Armor
    end if
    if attack = 0 then
        Weapon
    end if
    if keys (KEY_RIGHT_ARROW) and plx + 10 < maxx then
        plx := plx + 1
        Armor
        Weapon
    end if
    if move = 0 then
        Armor
    end if
    if attack = 0 then
        Weapon
    end if
    if keys (KEY_LEFT_ARROW) and plx - 10 > 0 then
        plx := plx - 1
        Armor
        Weapon
    end if
    if move = 0 then
        Armor
    end if
    if attack = 0 then
        Weapon
    end if
    % ------------
    %|Music Player|
    % ------------
    %Box
    Draw.Box (882, 500, 1022, 741, black)
    Draw.Box (883, 501, 1021, 740, brown)
    Draw.Box (884, 502, 1020, 739, brown)
    Draw.FillBox (885, 503, 1019, 738, black)
    %Text
    Draw.Text ("Music Tracks", 888, 747, largetext, white)
    Draw.Text ("1", 888, 727, smalltext, white)
    Draw.Text ("Dark Night", 908, 727, smalltext, white)
    Draw.Text ("2", 888, 707, smalltext, white)
    Draw.Text ("Epic Battle", 908, 707, smalltext, white)
    Draw.Text ("3", 888, 687, smalltext, white)
    Draw.Text ("Gates of Eden", 908, 687, smalltext, white)
    Draw.Text ("4", 888, 667, smalltext, white)
    Draw.Text ("Gods of Thunder", 908, 667, smalltext, white)
    Draw.Text ("5", 888, 647, smalltext, white)
    Draw.Text ("Premonition", 908, 647, smalltext, white)
    Draw.Text ("6", 888, 627, smalltext, white)
    Draw.Text ("Regression", 908, 627, smalltext, white)
    Draw.Text ("7", 888, 607, smalltext, white)
    Draw.Text ("The Rock of War", 908, 607, smalltext, white)
    Draw.Text ("8", 888, 587, smalltext, white)
    Draw.Text ("Tripwire", 908, 587, smalltext, white)
    %Track 1
    if keys ('1') then
        fork DarkNight
        Track1 := true
        Track2 := false
        Track3 := false
        Track4 := false
        Track5 := false
        Track6 := false
        Track7 := false
        Track8 := false
    end if
    if Track1 = true then
        Draw.Text ("Dark Night", 908, 727, smalltext, yellow)
    end if
    %Track 2
    if keys ('2') then
        fork EpicBattle
        Track1 := false
        Track2 := true
        Track3 := false
        Track4 := false
        Track5 := false
        Track6 := false
        Track7 := false
        Track8 := false
    end if
    if Track2 = true then
        Draw.Text ("Epic Battle", 908, 707, smalltext, yellow)
    end if
    %Track 3
    if keys ('3') then
        fork GatesofEden
        Track1 := false
        Track2 := false
        Track3 := true
        Track4 := false
        Track5 := false
        Track6 := false
        Track7 := false
        Track8 := false
    end if
    if Track3 = true then
        Draw.Text ("Gates of Eden", 908, 687, smalltext, yellow)
    end if
    %Track 4
    if keys ('4') then
        fork GodsofThunder
        Track1 := false
        Track2 := false
        Track3 := false
        Track4 := true
        Track5 := false
        Track6 := false
        Track7 := false
        Track8 := false
    end if
    if Track4 = true then
        Draw.Text ("Gods of Thunder", 908, 667, smalltext, yellow)
    end if
    %Track 5
    if keys ('5') then
        fork Premonition
        Track1 := false
        Track2 := false
        Track3 := false
        Track4 := false
        Track5 := true
        Track6 := false
        Track7 := false
        Track8 := false
    end if
    if Track5 = true then
        Draw.Text ("Premonition", 908, 647, smalltext, yellow)
    end if
    %Track 6
    if keys ('6') then
        fork Regression
        Track1 := false
        Track2 := false
        Track3 := false
        Track4 := false
        Track5 := false
        Track6 := true
        Track7 := false
        Track8 := false
    end if
    if Track6 = true then
        Draw.Text ("Regression", 908, 627, smalltext, yellow)
    end if
    %Track 7
    if keys ('7') then
        fork TheRockofWar
        Track1 := false
        Track2 := false
        Track3 := false
        Track4 := false
        Track5 := false
        Track6 := false
        Track7 := true
        Track8 := false
    end if
    if Track7 = true then
        Draw.Text ("The Rock of War", 908, 607, smalltext, yellow)
    end if
    %Track 8
    if keys ('8') then
        fork Tripwire
        Track1 := false
        Track2 := false
        Track3 := false
        Track4 := false
        Track5 := false
        Track6 := false
        Track7 := false
        Track8 := true
    end if
    if Track8 = true then
        Draw.Text ("Tripwire", 908, 587, smalltext, yellow)
    end if
    % ---------
    %|Map Level|
    % ---------
    Draw.Text ("Realm of Genthus", 285, 10, maptext, red)
    Draw.Text ("B" + plflo, 593, 10, floortext, black)
    % ------
    %|Status|
    % ------
    %Box
    Draw.FillBox (0, 0, 200, 100, black)
    Draw.Box (0, 1, 203, 103, black)
    Draw.Box (1, 2, 201, 101, brown)
    Draw.Box (2, 3, 202, 102, brown)
    %Text
    Draw.Text ("Status", 5, 108, largetext, white)
    Draw.Text ("Kaine", 5, 83, nametext, white)
    Draw.Text ("LVL", 58, 83, smalltext, white)
    Draw.Text (plvl, 84, 83, smalltext, yellow)
    Draw.Text ("Rank", 5, 70, smalltext, white)
    Draw.Text (prank, 35, 70, smalltext, 53)
    %Experience
    Draw.Text ("Current", 105, 83, smalltext, white)
    Draw.Text (pexp, 152, 83, smalltext, green)
    Draw.Text ("Next", 124, 70, smalltext, white)
    Draw.Text (pexpn, 152, 70, smalltext, 12)
    %Health
    Draw.Text ("HP", 5, 52, smalltext, white)
    Draw.FillBox (30, 51, plhel, 61, 12)
    Draw.Box (30, 51, plhelb, 61, white)
    Draw.Text (healthval, 180, 51, smalltext, white)
    %Attack
    Draw.Text ("ATT", 5, 32, smalltext, white)
    Draw.FillBox (30, 31, plattb, 41, green)
    Draw.Box (30, 31, plattb, 41, white)
    Draw.Text (attackval, 180, 31, smalltext, white)
    %Defense
    Draw.Text ("DEF", 5, 12, smalltext, white)
    Draw.FillBox (30, 11, pldefb, 21, blue)
    Draw.Box (30, 11, pldefb, 21, white)
    Draw.Text (defenseval, 180, 11, smalltext, white)
    % ---------
    %|Equipment|
    % ---------
    %Text
    Draw.Text ("Equipment", 705, 310, largetext, white)
    %Box
    Draw.FillBox (700, 0, 1023, 300, black)
    Draw.Box (703, 1, 1022, 300, black)
    Draw.Box (702, 2, 1021, 299, brown)
    Draw.Box (701, 3, 1020, 298, brown)
    %Helm
    Draw.Box (820, 195, 900, 265, grey)
    %Armor
    Draw.Box (800, 20, 920, 160, grey)
    %Left Weapon
    Draw.Box (725, 30, 775, 265, grey)
    %Right Weapon
    Draw.Box (946, 30, 996, 265, grey)
    %Equipped
    if currenthelm = 0 then
        HornedHelm
    end if
    if currentweapon = 0 then
        RydensDemise
    end if
    if currentarmor = 0 then
        SteelPlate
    end if
    % ------------
    %|Enemy Status|
    % ------------
    %Box
    Draw.FillBox (3, 606, 200, 739, black)
    Draw.Box (0, 603, 203, 742, black)
    Draw.Box (1, 604, 202, 741, brown)
    Draw.Box (2, 605, 201, 740, brown)
    %Text
    Draw.Text ("Enemies", 5, 747, largetext, white)
    %Bars
    Draw.Text ("Minor Goblin", 7, 726, smalltext, white)
    if mgobhealth = 7 then
        Draw.Text ("DEAD", 87, 726, smalltext, 12)
    end if
    Draw.FillBox (7, 711, mgobhealth, 721, 12)
    Draw.Box (7, 711, 55, 721, white)
    View.Update
    delay (0)
    cls
end loop
Sponsor
Sponsor
Sponsor
sponsor
Spence607




PostPosted: Wed Jan 14, 2009 10:22 am   Post subject: Re: Game Attack Key

Turing:

  Input.KeyDown (keys)
    if keys (KEY_UP_ARROW) and ply + 10 < maxy and ply + 10 < maxy then
        ply := ply + 1
        Armor
        Weapon
    end if
    if move = 0 then
        Armor
    end if
    if attack = 0 then
        Weapon
    end if
    if keys (KEY_DOWN_ARROW) and ply - 10 > 0 then
        ply := ply - 1
        Armor
        Weapon
    end if
    if move = 0 then
        Armor
    end if
    if attack = 0 then
        Weapon
    end if
    if keys (KEY_RIGHT_ARROW) and plx + 10 < maxx then
        plx := plx + 1
        Armor
        Weapon
    end if
    if move = 0 then
        Armor
    end if
    if attack = 0 then
        Weapon
    end if
    if keys (KEY_LEFT_ARROW) and plx - 10 > 0 then
        plx := plx - 1
        Armor
        Weapon
    end if
    if move = 0 then
        Armor
    end if
    if attack = 0 then
        Weapon
    end if


That was the problem, the move and attack if statements only needed to be declared once. Just thought I'd let you know.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: