Help with a game I try cook

Ask gaming related questions (AHK v1.1 and older)
zuko
Posts: 3
Joined: 17 Jan 2024, 05:54

Help with a game I try cook

17 Jan 2024, 05:57

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.]
zuko
Posts: 3
Joined: 17 Jan 2024, 05:54

Re: Help with a game I try cook

24 Jan 2024, 17:59

Code: Select all

#SingleInstance Force
#Persistent
SetBatchLines, -1
CoordMode, Mouse, Client
;Soundplay is very loud and I couldn't find another way to achieve what I'm looking for this has a bug where if you keep opening the game the volume will eventually reach zero, other than that it works.
Send {Volume_Down 20}

Background_Sprite = %A_Temp%\background.jpg
FileInstall, background.jpg, %Background_Sprite%, 1

Player_Sprite = %A_Temp%\playerbrad.png
FileInstall, playerbrad.png, %Player_Sprite%, 1

Enemy_Sprite = %A_Temp%\enemy.png
FileInstall, enemy.png, %Enemy_Sprite%, 1

Missing = %A_Temp%\miss.mp3
FileInstall, miss.mp3, %Missing%, 1

Hitting = %A_Temp%\hit.mp3
FileInstall, hit.mp3, %Hitting%, 1


;various variables I don't really understand why to use a global or not but it's okay, atleast in ahk
global Game:={W:A_ScreenWidth,H:A_ScreenHeight,WHalf:A_ScreenWidth/2,HHalf:A_ScreenHeight/2}
Lvl_Diff:= "100"
Player:={X:225,Y:650,W:300,H:300,Hp:1000,Ap:100,Spd:2,Dmg:1,DmgTotal:0,Atk:50,Def:1,Exp:0,Skill:0,Lvl:0,Dir:1,Last_Dir:0}
Enemy:={X:Game.WHalf,Y:650,XO:Enemy.X,YO:Enemy.Y,W:300,H:300,Hp:Enemy.HpTotal,HpTotal:100,Spd:2,Dmg:1,DmgTotal:0,Atk:10,Def:2,Lvl:0,Dir:1,Last_Dir:0,Fell:0}

Gui,1:-Caption
Gui,1: Add, Picture,% "x0 y0 w" Game.W " h" Game.H,% Background_Sprite
Gui, 1:Font, cWhite s40, IMPACT
Gui,1: Add, Text, x10 y10 w100 h60 +Border cLime vPlayer_Hp,% Player.Hp ;Player Health
Gui,1: Add, Text, x10 y75 w100 h60 +Border cAqua vPlayer_Ap,% Player.Ap ;Showing our players Attack points left to spend
Gui,1: Add, Text, x10 y150 w100 h60 +Border cRed vEnemy_Fell,% Enemy.Fell ;Counting our kill count to possibly do something with it later
Gui,1: Add, Text,% "x" Game.W-110 " y10" " w100 h50 vEnemy_Hp +Border BackGroundRed",% Enemy.HpTotal


;Drawing both our players using variables for positions for animations 
Gui, 1:Add, Picture,% "x" Player.X " y" Player.Y " w" Player.W  " h" Player.H " BackGroundTrans +border vPlayer_1",% Player_Sprite
Gui, 1:Add, Picture,% "x" Enemy.X " y" Enemy.Y " w" Enemy.W  " h" Enemy.H " BackGroundTrans +border vEnemy_1",% Enemy_Sprite


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:Font, cWhite s72, Cooper Black
Gui, 1:Add, Text,% "x" Game.WHalf " y" Game.HHalf-250 "w500 h350 Center BackGroundTrans vLevel_Up Hidden", Level Up!
Gui, 1:Add, Text,% "x" Game.WHalf " y" Game.HHalf-250 "w500 h350 Center BackGroundTrans vEnemy_Miss Hidden", Enemy Missed!
Gui, 1:Add, Text,% "x" Game.WHalf " y" Game.HHalf-250 "w500 h350 Center BackGroundTrans vEnemy_Dead Hidden", Enemy Felled!

;Various Health Bars etc.

Gui, 1:Show,% "x0 y0" " w" Game.W " h" Game.H, Game

SetTimer, Game_Loop, 10
return

GuiClose:
GuiEscape:
*^ESC::
	Send {Volume_Up 20}
	ExitApp

Game_Loop:
Gui, 1:Submit, NoHide
; Dev Controls
if(GetKeyState("W"))
	Player.Hp-=1
if(GetKeyState("S"))
	Player.Ap-=1
if(GetKeyState("D"))
	Player.Exp+=1

;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 Enemy if they are out of AP
	}
	GuiControl,,Player_Exp,% Player.Exp

	GuiControl,,Enemy_Hp,% Enemy.Hp
	if(Enemy.Hp<=0)
		{   ;We've beat the enemy so now we need too award exp
			Player.Exp += 75
			;Now we can reset the the enemies hp
			Enemy.Hp:=Enemy.HpTotal
			Gui, 1:Submit, NoHide
		}
	GuiControl,,Enemy_Ap,% Enemy.Ap
	if(Enemy.Ap<=0)
	{
		Enemy.Ap:=0
		;Nothing needs to happen yet
	}
	GuiControl,,Enemy_Exp,% Enemy.Exp

	if(Player.Exp>=Lvl_Diff) ;Checking if the player meets the Exp requirement
	{
		Player.Lvl+=1
		Enemy.Lvl+=1
		Lvl_Diff+=25 ;Player is rewarded and the difficulty is increased
		Player.Exp:=0
		GuiControl, Show, Level_Up
		;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
				}

			if (Enemy.Lvl >= 5 && !Mod(Enemy.Lvl, 5))
				{
					Enemy.HpTotal += 25
					Player.Skill += 1

						if (Player.Ap > 100)
							Player.Ap := 100

						if (Player.Hp > 100)
							Player.Hp := 100
				}
		Sleep 1000
		GuiControl, Hide, Level_Up
		goto, Skill_Up
	}
return

Room: ;some logic to decide what the room you are entering has in it

return


Attack: ;attack logic
GuiControl, 1:Move, Player_1,% "x" Player.X " y" Player.Y-10
SoundPlay %Hitting%
sleep 150 ;Player Attack Animation
GuiControl, 1:Move, Player_1,% "x" Player.X " y" Player.Y+10

Player.DmgTotal:= Player.Atk * Player.Dmg
Player.DmgTotal /= Enemy.Def
Player.Ap-=1
sleep 10
Enemy.Hp -= Player.DmgTotal ;Player does damage to his enemy

GuiControl, 1:Move, Enemy_1,% "x" Enemy.X+15
sleep 150 ;Enemy Damaged Animation
GuiControl, 1:Move, Enemy_1,% "x" Enemy.X-15


sleep 1000 ;how long we want our enemy to be stunned for, this could be made a variable which could be really cool and vary combat times

if (Enemy.Hp<=0)
{
	GuiControl, 1:Show, Enemy_Dead
	Enemy.Fell+=1
	sleep 2000
	GuiControl, 1:Hide, Enemy_Dead
}
else
{
GuiControl, 1:Move, Enemy_1,% "x" Enemy.X " y" Enemy.Y+10
SoundPlay %Hitting%
sleep 150 ;Enemy Attack Animation
GuiControl, 1:Move, Enemy_1,% "x" Enemy.X " y" Enemy.Y-10

Random AttackIf, 1, 15+Player.Spd

		if (AttackIf <= 10)
			{
				Enemy.DmgTotal:= Enemy.Atk * Enemy.Dmg
				Enemy.DmgTotal /= Player.Def
				Enemy.Ap-=1
				sleep 10
				Player.Hp -= Enemy.DmgTotal ;Player does damage to his enemy

				GuiControl, 1:Move, Player_1,% "x" Player.X-15
				sleep 150 ;Player Damaged Animation
				GuiControl, 1:Move, Player_1,% "x" Player.X+15
			}
		else
			{
				GuiControl, 1:Show, Enemy_Miss
				Gui, 1:Submit, NoHide
				SoundPlay %Missing%
				sleep 500
				GuiControl, 1:Hide, Enemy_Miss
			}
}
Gui, 1:Submit, NoHide
return

Inventory:
Gui, Inv:Color, Silver
Gui, Inv:Font, cWhite s24, Cooper Black
Gui, Inv: Show, x400 y400 w500 h500, Inventory
Gui, Inv: Add, Text, , Inventory
Gui, Inv: Add, Text, x+10 gCloseInv, [x]
Gui, Inv: Add, Text, x10 y+10 +Border, Item1
Gui, Inv: Add, Text, x+10 +Border, Item2
Gui, Inv: Add, Text, x+10 +Border, Item3
Gui, Inv: Add, Text, x+10 +Border, Item4



Gui, Inv: +LastFound +AlwaysOnTop -Caption +ToolWindow +E0x20
WinSet, Region, 0-0 w400 h400 R30-15
return

CloseInv:
Gui, Inv: 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

		Gui, SS:Show, x500 y500 w200 h200, Select Skill
		Gui, SS:Add, Button, x10 y10 w100 h20 gSkill1, Speed
		Gui, SS:Add, Button, x10 y+20 w100 h20 gSkill2, Damage
		Gui, SS:Add, Button, x10 y+20 w100 h20 gSkill3, Defense
	}
return

Skill1: ;Speed Skill
GuiControl, Show, Skill_Spd
Player.Spd += 5
Sleep, 1000
GuiControl, Hide, Skill_Spd
Gui, SS:Destroy
return


Skill2: ;Damage Skill
GuiControl, Show, Skill_Dmg
Player.Dmg += 1
Sleep, 1000
GuiControl, Hide, Skill_Dmg
Gui, SS:Destroy
return


Skill3: ;Defense Skill
GuiControl, Show, Skill_Def
Player.Def += 1
Sleep, 1000
GuiControl, Hide, Skill_Def
Gui, SS:Destroy
return

;the inventory needs items currently thinking of rewarding the items upon killing an enemy but also from lootable chest items being potions: Speed Attack Defense potion(s) directly affects skill for x rounds, maybe this can be modified depending on how many enemies we have killed
;Peglin campaign map style of moving room to room, the layout can be randomised by 3 main room types: Loot filled with chests to pick from, Enemy filled with enemies, ?Room? /?/ambush of enemies or rare loot but the loot is rare /?/ = I don't know about this part
;there also should probably be a boss room but I don't want to make this a part of these 3 rooms, because I don't want the player to randomly get started on a boss room


note: I am new to this and would love any pointers or any input at all, if you don't like how I'm doing something or I'm doing it stupidly I would love to hear your input and learn from it
Rohwedder
Posts: 7704
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help with a game I try cook

25 Jan 2024, 12:28

Hallo,
doesn't this game require any image and sound files to run?
I don't have a working sandbox at the moment and do not run any ominous scripts in order not to damage my computer.
zuko
Posts: 3
Joined: 17 Jan 2024, 05:54

Re: Help with a game I try cook

28 Jan 2024, 15:02

Rohwedder wrote:
25 Jan 2024, 12:28
Hallo,
doesn't this game require any image and sound files to run?
I don't have a working sandbox at the moment and do not run any ominous scripts in order not to damage my computer.
Yes it has sounds they are quite loud, they are not required to run it though, if there is an error the SoundPlay can be commented out in your script. The imagery for the game background and player, are not necessary to see how the variables interact with eachother, I could upload a compiled exe of the file, but I doubt anyone wants that. Just put your own background and player pictures in the directory with the names defined in the top of the script.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 36 guests