469,142 Members | 1,125 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,142 developers. It's quick & easy.

I need help with my game in Autohotkey

#Singleinstance,Force
Player:={x:200, y:200, w:20, h:20, speed:5}
Health:={x:10, y:10, w:100, h:20, HP1:100}

Gui,+AlwaysOnTop
Gui,color, Black
gui, font, s10 cWhite

Gui add, text, x5 y5 vtext1, test1
Gui add, text, x5 y20 vtext2, test2
Gui add, text, x5 y35 vtext3, test3
Gui add, text, x5 y35 vtext4, test4
Gui, Font, s12 cd5d5d5 , Calibri
Gui, Add, Edit, cBlack vEdit1, %Username%
gui, show, w300 h200
sleep, 3000
guicontrol, hide, text1
guicontrol, hide, text2
guicontrol, hide, text3
guicontrol, hide, text4
gui, add, Picture, w400 h40, C:\Users\Tomas2\Desktop\health.png
gui, add, Picture, w1895 h970 vPic, C:\Users\%Username%\Desktop\room.png
gui, add, Picture, w1895 h970 vPic1, C:\Users\%Username%\Desktop\room.png
gui,add, progress,% "x" Player.x " y" Player.y " w" Player.w " h" Player.h " cWhite BackGroundLime vPlayer_1"
guicontrol, hide, Pic1
Gui, show, x0 y0 w1913 h1010, Game
SetTimer,Move_player,10
__________________________________________________ __________________________________________________ __________________________
HP1:
{
GuiControl, ,Health.HP1, %HP1% ;Guicontrol, ,Health_Health, "amount of health"
Guicontrol,, Health_HP1, amount of health
}

loop
{
if(GetKeyState("1"))
{
Tooltip,% Health.HP1

}

if(GetKeyState("2"))
{
CoordMode, Mouse, Screen
SetTimer, Check, 9999999


Check:
MouseGetPos, xx, yy
Tooltip %xx%`, %yy%



}
}

^m::

player.speed+=sped
Guicontrol, Move,Player_1, % "x" player.x " y" player.y


return
Guiclose:
Exitapp
Move_player:
Damage:=10
sped:=5
man:=5
if(GetKeyState("up"))
{
if(player.y>0)
player.y-=player.speed
if(player.y=10)
Health.HP1-=Damage
}
if(Getkeystate("down"))
{
if(player.y<1010-player.h)
player.y+=player.speed
if(player.y=985)
Health.HP1-=Damage

}
if(Getkeystate("left"))
{
if(player.x>0)
player.x-=player.speed
if(player.x=20)
Health.HP1-=Damage
}
if(Getkeystate("right"))
{
if(player.x<1910-player.w)
player.x+=player.speed
}

if(player.x=1885)
GuiControl, Hide, Pic





if(Health.HP1=0)
Guiclose_die:
Exitapp

if health.HP1=90

{

gui, font, cBlack
gui, add, text, x375 y10 w40 h40, ffff
Health.HP1+=man
gui, font, cBlack
gui, add, text, x375 y10 w40 h40, ffff


}

if health.HP1=85

{
gui, font, cBlack
gui, add, text, x335 y10 w40 h40, ffff
Health.HP1-=man
gui, font, cBlack
gui, add, text, x335 y10 w40 h40, ffff
}

if health.HP1=70

{

gui, font, cBlack
gui, add, text, x295 y10 w40 h40, ffff
Health.HP1+=man
gui, font, cBlack
gui, add, text, x295 y10 w40 h40, ffff


}

if health.HP1=65

{
gui, font, cBlack
gui, add, text, x255 y10 w40 h40, ffff
Health.HP1-=man
gui, font, cBlack
gui, add, text, x255 y10 w40 h40, ffff
}

if health.HP1=50

{

gui, font, cBlack
gui, add, text, x215 y10 w40 h40, ffff
Health.HP1+=man
gui, font, cBlack
gui, add, text, x215 y10 w40 h40, ffff


}

if health.HP1=45

{
gui, font, cBlack
gui, add, text, x175 y10 w40 h40, ffff
Health.HP1-=man
gui, font, cBlack
gui, add, text, x175 y10 w40 h40, ffff
}

if health.HP1=30

{

gui, font, cBlack
gui, add, text, x135 y10 w40 h40, ffff
Health.HP1+=man
gui, font, cBlack
gui, add, text, x135 y10 w40 h40, ffff


}

if health.HP1=25

{
gui, font, cBlack
gui, add, text, x95 y10 w40 h40, ffff
Health.HP1-=man
gui, font, cBlack
gui, add, text, x95 y10 w40 h40, ffff
}

if health.HP1=10

{

gui, font, cBlack
gui, add, text, x55 y10 w40 h40, ffff
Health.HP1+=man
gui, font, cBlack
gui, add, text, x55 y10 w40 h40, ffff


}

if health.HP1=5

{
gui, font, cBlack
gui, add, text, x15 y10 w40 h40, ffff
Health.HP1-=man
gui, font, cBlack
gui, add, text, x15 y10 w40 h40, ffff
}


Guicontrol, Move,Player_1, % "x" player.x " y" player.y
return


return
Aug 18 '21 #1
0 993

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Adam Haskell | last post: by
3 posts views Thread by Brian | last post: by
1 post views Thread by Srinivasa Ra via .NET 247 | last post: by
25 posts views Thread by Mark | last post: by
1 post views Thread by Arvind P Rangan | last post: by
reply views Thread by saravanan_article | last post: by
6 posts views Thread by Thily | last post: by
8 posts views Thread by rdabane | last post: by
1 post views Thread by bravesjohn | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.