Making game with AHK
Posted: 13 May 2016, 09:46
I want to know:
- The way to put scrolling effects in large images like in platform games
- Resize images automatically with size of the window resized in middle of script's operation
This guy made those things but i think he not made his game with external images:
https://autohotkey.com/board/topic/7838 ... platformer
I think i will make an game with external images like in this script for example:
- The way to put scrolling effects in large images like in platform games
- Resize images automatically with size of the window resized in middle of script's operation
This guy made those things but i think he not made his game with external images:
https://autohotkey.com/board/topic/7838 ... platformer
I think i will make an game with external images like in this script for example:
Code: Select all
;(o)image movement, sound, file path, text, save/load
;( )scrolling, auto resize images with window
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
IniRead, x, Filename, a, x , 20
IniRead, y, Filename, a, y , 100
Gui, +Resize
Gui, Add, Picture, vpic
Gui, Add, Picture, vpic2
GuiControl,, pic,%A_WorkingDir%\background.png
GuiControl,, pic2,%A_WorkingDir%\character.gif
Gui, Show, w1000 h700 xCenter y0,
GuiControl, Move, Pic2, % "x" x "y" y
loop
{
if GetKeyState("right", "P")
{
x += 20
GuiControl, Move, Pic2, % "x" x "y" y
SoundPlay, %A_WorkingDir%\sound.mp3
SoundPlay *-1
Sleep, 50
}
if GetKeyState("q", "P")
{
break
}
if GetKeyState("w", "P")
{
IniWrite, %x%, Filename, a, x
IniWrite, %y%, Filename, a, y
}
}
return
GuiClose:
ExitApp