Code: Select all
#SingleInstance Force
#Persistent
SetBatchLines, -1
CoordMode, Mouse, Client
global Game:={W:1920,H:1080}
Lvl_Diff:= "100"
Five_Lvl:=Player.Lvl/5
Player:={X:10,Y:10,W:15,H:15,Hp:100,Ap:100,Spd:2,Dmg:1,Atk:1,Def:1,Exp:0,Skill:0,Lvl:0,Dir:1,Last_Dir:0}
Played:={X:465,Y:10,W:25,H:25,Start_X:465,Start_Y:10,Speed:2}
Projectile:={X:0,Y:0, W:5, H:5, Spd:4, Dmg:0, Dir:1, Last_Dir:0}
EnemyNPC:={X:10,Y:10,W:15,H:15,Hp:100,Spd:2,Dmg:1,Atk:1,Def:1,Lvl:0,Dir:1,Last_Dir:0}
Border_Color:="Blue"
IsThere:=1
Gui,1:-Caption
Gui,1: Color, Black
;Various Health Bars etc.
Gui,1: Add, Progress, x10 y10 w300 h20 cLime BackGroundRed vPlayer_Hp,% Player.Hp
Gui,1: Add, Text, x+18 y9 cLime, HP
Gui,1: Add, Progress, x10 y35 w300 h20 cBlue BackGroundRed vPlayer_Ap,% Player.Ap
Gui,1: Add, Text, x+18 y34 cBlue, AP
Gui,1: Add, Progress, x10 y60 w300 h20 cWhite BackGroundRed vPlayer_Exp Range0-500, % Player.Exp
Gui,1: Add, Text, x+10 y59 cWhite,EXP
Gui,1: Add, Button, % "x" Game.W - 110 " y10 w100 h20 gMap", Map
Gui,1: Add, Button, x550 y600 w400 h400 vPlayer_1 , Player
Gui,1: Add, Button, x1020 y250 w250 h250 vEnemy_1 Hidden, Enemy1
Gui,1: Add, Button, x720 y1010 w250 h25 gAttack, Attack
Gui,1: Add, Button, x+10 y1010 w250 h25 gSkill_Up, Level Skill
Gui,1: Add, Button, x720 y1040 w250 h25 gInventory, Inventory
Gui,1: Add, Button, x980 y1040 w250 h25 gSkill, Skills
Gui, 1:Font, cWhite s44, Cooper Black
Gui, 1:Add, Text, x0 y150 w500 h350 Center BackGroundTrans vSkill_Spd Hidden, Speed +1
Gui, 1:Add, Text, x0 y150 w500 h350 Center BackGroundTrans vSkill_Dmg Hidden, Damage +1
Gui, 1:Add, Text, x0 y150 w500 h350 Center BackGroundTrans vSkill_Def Hidden, Defense +1
Gui, 1:Show,% "x0 y0" " w" Game.W " h" Game.H, Game
SetTimer, Game_Loop, 10
return
GuiClose:
GuiEscape:
*^ESC::
ExitApp
Game_Loop:
/* Dev Controls
if(GetKeyState("up"))
Player.Hp-=1
if(GetKeyState("left"))
Player.Ap-=1
if(GetKeyState("right"))
Player.Exp+=1
*/
if(GetKeyState("Up"))
{
if(Played.Y>0)
Played.Y-=Played.Speed
if(Played.Y<0)
Played.Y:=0
if(Played.Y=0)
{
}
}
if(GetKeyState("Down"))
{
if(Played.Y<500-Played.H)
Played.Y+=Played.Speed
if(Played.Y>500-Played.H)
Played.Y:=500-Played.H
if(Played.Y=500-Played.H)
{
}
}
if(GetKeyState("Left"))
{
if(Played.X>0)
Played.X-=Played.Speed
if(Played.X<0)
Played.X:=0
if(Played.X=0)
{
}
}
if(GetKeyState("Right"))
{
if(Played.X<500-Played.W)
Played.X+=Played.Speed
if(Played.X>500-Played.W)
Played.X:=500-Played.W
if(Played.X=500-Played.W)
{
}
}
GuiControl,Move,Played_1,% "x" Played.X " y" Played.Y
Played.X:=New_X-Played.W/2
Played.Y:=New_Y-Played.H/2
if((Played.X<50||Played.X>(500-Played.W)||Played.Y<0||Played.Y>(500-Played.H))
||(Played.X<150&&Played.X>100-Played.W&&Played.Y>50-Played.H)
||(Played.X<250&&Played.X>200-Played.W&&Played.Y<450)
||(Played.X<350&&Played.X>300-Played.W&&Played.Y>50-Played.H)
||(Played.X<450&&Played.X>400-Played.W&&Played.Y<450))
{
SetTimer,Game_Loop,Off
GuiControl, Move, Played_1,% "x" Played.Start_X " y" Played.Start_Y
;lose
}
if(Played.X>50&&Played.X<100-Played.W&&Played.Y>450-Played.H)
{
SetTimer,Game_Loop,Off
GuiControl, Move, Played_1,% "x" Played.Start_X " y" Played.Start_Y
;win
}
;CheckPlayerHealth()
;A function that looks for what enemy the player is attacking
GuiControl,,Player_Hp,% Player.Hp
if(Player.Hp<=0)
{ ;We've lost all our health so we are prompted if we would like to try again for 5 seconds if no input is detected the game closes.
MsgBox, 4, , You have lost all of your Health! Continue?, 5
IfMsgBox Timeout
ExitApp
else IfMsgBox Yes
{
Reload
ExitApp
}
else IfMsgBox No
ExitApp
}
GuiControl,,Player_Ap,% Player.Ap
if(Player.Ap<=0)
{
Player.Ap:=0
;Nothing needs to happen yet, this is telling us we are out of attack, but we don't want to stun lock our player if they are out of AP
}
GuiControl,,Player_Exp,% Player.Exp
if(Player.Exp>=Lvl_Diff) ;Checking if the player meets the Exp requirement
{
Player.Lvl+=1
Lvl_Diff+=25 ;Player is rewarded and the difficulty is increased
Player.Exp:=0
ToolTip, % Player.Lvl " Level `n" " +" Lvl_Diff " Experience `n" Player.Ap " Attack Points `n" Player.Skill " Skills"
if (Player.Lvl >= 5 && !Mod(Player.Lvl, 5))
{
Player.Ap += 25
Player.Hp += 25
Player.Skill += 1
if (Player.Ap > 100)
Player.Ap := 100
if (Player.Hp > 100)
Player.Hp := 100
}
}
return
Room: ;some logic to decide what the room you are entering has in it
return
Attack: ;attack logic
return
Inventory:
Gui, 3:Color, Silver
Gui, 3:Font, cWhite s24, Cooper Black
Gui, 3: Show, x400 y400 w500 h500, Inventory
Gui, 3: Add, Text, , Inventory
Gui, 3: Add, Text, x+130 gCloseInv, [x]
Gui, 3: +LastFound +AlwaysOnTop -Caption +ToolWindow +E0x20
WinSet, Region, 0-0 w400 h400 R30-15
return
CloseInv:
Gui, 3: Destroy
return
Skill:
Gui, 2: Color, feffff
Gui, 2:Font, cWhite s24, Cooper Black
Gui, 2: Show, x200 y200 w500 h300, Skills
Gui, 2: Add, Text, , % Player.Spd " Speed"
Gui, 2: Add, Text, , % Player.Dmg " Damage"
Gui, 2: Add, Text, , % Player.Def " Defense"
Gui, 2: +LastFound +AlwaysOnTop -Caption +ToolWindow +E0x20
WinSet, TransColor, feffff
sleep 3000
Gui, 2: Destroy
return
Skill_Up: ;modify skills in a cool way, + 1 random attribute, or add the option to choose between the three
if (Player.Skill > 0)
{
Player.Skill -= 1
Random, Skill, 1, 3
if (Skill = 1)
{
GuiControl, Show, Skill_Spd
Player.Spd += 1
Sleep, 1000
GuiControl, Hide, Skill_Spd
}
if (Skill = 2)
{
GuiControl, Show, Skill_Dmg
Player.Dmg += 1
Sleep, 1000
GuiControl, Hide, Skill_Dmg
}
if (Skill = 3)
{
GuiControl, Show, Skill_Def
Player.Def += 1
Sleep, 1000
GuiControl, Hide, Skill_Def
}
}
return
Map: ;A gui game that travels to the next room
Gui, 4:+AlwaysOnTop
Gui, 4:Color, Gray
;SCRIPT BREAKS HERE ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Please help I cant wrap my head around why this wouldnt work
Gui, Add, Progress,% "x" Played.X " y" Played.Y " w" Played.W " h" Played.H " cLime BackGroundRed vPlayed_1",
Gui, 4:Add, Progress, x0 y0 w50 h500 BackGround%Border_Color%
Gui, 4:Add, Progress, x100 y50 w50 h450 BackGround%Border_Color%
Gui, 4:Add, Progress, x200 y0 w50 h450 BackGround%Border_Color%
Gui, 4:Add, Progress, x300 y50 w50 h450 BackGround%Border_Color%
Gui, 4:Add, Progress, x400 y0 w50 h450 BackGround%Border_Color%
Gui, 4:Add, Progress, x50 y450 w50 h50 BackGroundLime
Gui, 4:Show, x1200 y100 w500 h500, Map
return
;Very complicated scrapped messed up if checks on player combat,
/*
Path1:
Random, P1, 1, 3
If (P1=1)
{
GuiControl, Show, Path_1
GuiControl, ,Path_1
;Stays a path
}
else if (P1=2)
{
GuiControl, Show, Loot_1
GuiControl, ,Loot_1
GuiControl, Hide, Path_1
;Becomes a lootable chest
}
else if (P1=3)
{
GuiControl, Show, Enemy_1
GuiControl, ,Enemy_1
GuiControl, Hide, Path_1
;Becomes an Enemy
}
return
Path2:
Random, P2, 1, 3
If (P2=1)
{
GuiControl, Show, Path_2
GuiControl, ,Path_2
;Stays a path
}
else if (P2=2)
{
GuiControl, Show, Loot_2
GuiControl, ,Loot_2
GuiControl, Hide, Path_2
;Becomes a lootable chest
}
else if (P2=3)
{
GuiControl, Show, Enemy_2
GuiControl, ,Enemy_2
GuiControl, Hide, Path_2
;Becomes an Enemy
}
return
Path3:
Random, P3, 1, 3
If (P3=1)
{
GuiControl, Show, Path_3
GuiControl, ,Path_3
;Stays a path
}
else if (P3=2)
{
GuiControl, Show, Loot_3
GuiControl, ,Loot_3
GuiControl, Hide, Path_3
;Becomes a lootable chest
}
else if (P3=3)
{
GuiControl, Show, Enemy_3
GuiControl, ,Enemy_3
GuiControl, Hide, Path_3
;Becomes an Enemy
}
return
Loot1:
Random, L1, 1, 3
If (L1=1)
{
GuiControl, Show, Path_1
GuiControl, ,Path_1
GuiControl, Hide, Loot_1
;Stays a path
}
else if (L1=2)
{
GuiControl, Show, Loot_1
GuiControl, ,Loot_1
;Becomes a lootable chest
}
else if (L1=3)
{
GuiControl, Show, Enemy_1
GuiControl, ,Enemy_1
GuiControl, Hide, Loot_1
;Becomes an Enemy
}
return
Loot2:
Random, L2, 1, 3
If (L2=1)
{
GuiControl, Show, Path_2
GuiControl, ,Path_2
GuiControl, Hide, Loot_2
;Stays a path
}
else if (L2=2)
{
GuiControl, Show, Loot_2
GuiControl, ,Loot_2
;Becomes a lootable chest
}
else if (L2=3)
{
GuiControl, Show, Enemy_2
GuiControl, ,Enemy_2
GuiControl, Hide, Loot_2
;Becomes an Enemy
}
return
Loot3:
Random, L3, 1, 3
If (L3=1)
{
GuiControl, Show, Path_3
GuiControl, ,Path_3
GuiControl, Hide, Loot_3
;Stays a path
}
else if (L3=2)
{
GuiControl, Show, Loot_3
GuiControl, ,Loot_3
;Becomes a lootable chest
}
else if (L3=3)
{
GuiControl, Show, Enemy_3
GuiControl, ,Enemy_3
GuiControl, Hide, Loot_3
;Becomes an Enemy
}
return
Enemy1:
Random, E1, 1, 3
If (E1=1)
{
GuiControl, Show, Path_1
GuiControl, ,Path_1
GuiControl, Hide, Enemy_1
;Stays a path
}
else if (E1=2)
{
GuiControl, Show, Loot_1
GuiControl, ,Loot_1
GuiControl, Hide, Enemy_1
;Becomes a lootable chest
}
else if (E1=3)
{
GuiControl, Show, Enemy_1
GuiControl, ,Enemy_1
;Becomes an Enemy
}
return
;Sleep, 2000
;GuiControl, Hide, Enemy_1
Enemy2:
Random, E2, 1, 3
If (E2=1)
{
GuiControl, Show, Path_2
GuiControl, ,Path_2
GuiControl, Hide, Enemy_2
;Stays a path
}
else if (E2=2)
{
GuiControl, Show, Loot_2
GuiControl, ,Loot_2
GuiControl, Hide, Enemy_2
;Becomes a lootable chest
}
else if (E2=3)
{
GuiControl, Show, Enemy_2
GuiControl, ,Enemy_2
;Becomes an Enemy
}
return
Enemy3:
Random, E3, 1, 3
If (E3=1)
{
GuiControl, Show, Path_3
GuiControl, ,Path_3
GuiControl, Hide, Enemy_3
;Stays a path
}
else if (E3=2)
{
GuiControl, Show, Loot_3
GuiControl, ,Loot_3
GuiControl, Hide, Enemy_3
;Becomes a lootable chest
}
else if (E3=3)
{
GuiControl, Show, Enemy_3
GuiControl, ,Enemy_3
;Becomes an Enemy
}
return
Attack1: ;quick attack
GuiControl, Hide, Enemy_1
return
;Player.Dmg*Player.Atk
Attack2: ;heavy attack
return
;Player.Dmg*Player.Atk
Attack3: ;something speed related
Player.Spd+=1
return
Attack4: ;defensive block
Player.Def+=1
return*/
[Mod edit: Fixed code tags. They go around the code, not after it.]
[Mod action: Moved topic to the v1 section since this is v1 code. The main section is for v2.]