Making game with AHK

Ask gaming related questions (AHK v1.1 and older)
User avatar
Hajin
Posts: 51
Joined: 13 May 2016, 09:16

Making game with AHK

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:

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
Last edited by Hajin on 11 Jun 2023, 23:54, edited 4 times in total.
User avatar
TheDewd
Posts: 1513
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Making game with AHK

13 May 2016, 15:13

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
User avatar
Hajin
Posts: 51
Joined: 13 May 2016, 09:16

Re: Making game with AHK

13 May 2016, 15:30

Interesting ... "downloaded times +1" :+1:
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Making game with AHK (NOT solved)

24 Jul 2016, 08:11

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 184 times

Edit: Fixed attachments, now in rar because images were scaled.
User avatar
Hajin
Posts: 51
Joined: 13 May 2016, 09:16

Re: Making game with AHK (NOT solved)

24 Jul 2016, 21:25

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.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 80 guests