Page 1 of 1

Making game with AHK

Posted: 13 May 2016, 09:46
by Hajin
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:

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

Re: Making game with AHK

Posted: 13 May 2016, 15:13
by TheDewd
I worked on a game in AHK once... I have since abandoned the project, but you may be able to get inspiration from it...

https://autohotkey.com/boards/viewtopic.php?t=7348

Re: Making game with AHK

Posted: 13 May 2016, 15:30
by Hajin
Interesting ... "downloaded times +1" :+1:

Re: Making game with AHK (NOT solved)

Posted: 24 Jul 2016, 08:11
by Helgef
Hajin wrote:I want to know:

- The way to put scrolling effects in large images like in platform games
I made you and example game, it scrolls a background and moves a player, use left and right arrows.
Put all files in same folder and run, Esc::ExitApp

Code:
Spoiler
Please verify that platform.png is 3382x448 pixels and mushy4.gif is 64x64. Other wise I need to find an alternate upload.

mushy.rar
mushy.ahk, mushy4.gif, platform.png
(10.63 KiB) Downloaded 185 times

Edit: Fixed attachments, now in rar because images were scaled.

Re: Making game with AHK (NOT solved)

Posted: 24 Jul 2016, 21:25
by Hajin
Looks good, after some things i will test this script...
I'm making a game with other system, currently.
I still have interest in make game with AHK...
AHK is very interesting.