Сам список трюков:
Загрузка и сохранение данных в играх, написанных в AppGameKit
Определение цветов точки на мониторе
Решение починки AppGameKit Classic, почему программа сама закрывается сразу после запуска.
Сохранение и Загрузка данных на телефонах андройд и веб-браузерах
Погуглив первоисточник форум сайта The Game Creators:
Работает на андройд телефонах и в web-браузере.
Первоисточник с примером от туда.
// Project: Save as String
// Created: 2022-11-02
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Save as String" )
SetWindowSize( 640,360, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1280,720 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
GLOBAL Device$ //Used to determine SaveSharedVariable or WriteLine/String()
Device$ = GetDeviceBaseName()
Type Stats //Some data to save
Health, Armor, Damage
EndType
GLOBAL Player as Stats
Load() // Load & Parse the String if it exists.
//Create Buttons to change data; Clicking will Increase & Save Player Stats
GLOBAL HealthBUT, ArmorBUT, DamageBUT, WriteBUT
HealthBUT = 1 : MakeHealth()
ArmorBUT = 2 : MakeArmor()
DamageBUT = 3 : MakeDamage()
WriteBUT = 4 : MakeWrite()
If Device$ = "html5" or Device$ = "android" //only on Desktop
SetVirtualButtonColor(WriteBUT, 128,0,0)
SetVirtualButtonActive(WriteBUT,0)
EndIf
do
If GetVirtualButtonPressed(HealthBUT) then INC_Health()
If GetVirtualButtonPressed(ArmorBUT) then INC_Armor()
If GetVirtualButtonPressed(DamageBUT) then INC_Damage()
If GetVirtualButtonPressed(WriteBUT) then OpenBrowser(GetWritePath() + "media")
Sync()
loop
Function INC_Health()
INC Player.Health, Random(1,3)
SetVirtualButtonText(HealthBUT,"Health" + CHR(10) + STR(Player.Health))
Save()
EndFunction
Function INC_Armor()
INC Player.Armor, Random(1,3)
SetVirtualButtonText(ArmorBUT,"Armor" + CHR(10) + STR(Player.Armor))
Save()
EndFunction
Function INC_Damage()
INC Player.Damage, Random(1,3)
SetVirtualButtonText(DamageBUT,"Damage" + CHR(10) + STR(Player.Damage))
Save()
EndFunction
Function MakeHealth()
AddVirtualButton(HealthBUT,100,100,100)
SetVirtualButtonText(HealthBUT,"Health" + CHR(10) + STR(Player.Health) )
EndFunction
Function MakeArmor()
AddVirtualButton(ArmorBUT,200,100,100)
SetVirtualButtonText(ArmorBUT,"Armor" + CHR(10) + STR(Player.Armor))
EndFunction
Function MakeDamage()
AddVirtualButton(DamageBUT,300,100,100)
SetVirtualButtonText(DamageBUT,"Damage" + CHR(10) + STR(Player.Damage))
EndFunction
Function MakeWrite()
AddVirtualButton(WriteBUT,500,100,100)
SetVirtualButtonText(WriteBUT,"Open" + CHR(10) + "Write$")
EndFunction
Function Load()
If Device$ = "html5" or Device$ = "android"
ThisSave$ = LoadSharedVariable("SaveGame", "missing")
Else
If GetFileExists("save.dat")
ThisFile = OpenToRead("save.dat")
ThisSave$ = ReadLine(ThisFile)
Else
ThisSave$ = "missing"
EndIf
EndIf
ParseSave$(ThisSave$)
EndFunction
Function ParseSave$(ThisSave$)
//if file/cookie exists, else set defaults and save
If ThisSave$ <> "missing"
Total = CountStringTokens(ThisSave$, "|") //total sets of paired data in string
For x = 1 to Total
ThisStat$ = GetStringToken(ThisSave$, "|", x)
//divide the paired data (stat:value) and assign
If GetStringToken(ThisStat$,":", 1) = "Health"
Player.Health = VAL(GetStringToken(ThisStat$,":", 2))
EndIf
If GetStringToken(ThisStat$,":", 1) = "Armor"
Player.Armor = VAL(GetStringToken(ThisStat$,":", 2))
EndIf
If GetStringToken(ThisStat$,":", 1) = "Damage"
Player.Damage = VAL(GetStringToken(ThisStat$,":", 2))
EndIf
next x
Else
Player.Health = 10
Player.Armor = 10
Player.Damage = 5
Save()
EndIf
EndFunction
Function Save()
//create respective pairs of data (stat:value)
Health$ = "Health:"+STR(Player.Health)
Armor$ = "Armor:"+STR(Player.Armor)
Damage$ = "Damage:"+STR(Player.Damage)
//combine individual data sets separated by pipes |
SaveString$ = Health$ + "|" + Armor$ + "|" + Damage$
If Device$ = "html5" or Device$ = "android"
SaveSharedVariable("SaveGame", SaveString$)
Else
ThisFile = OpenToWrite("save.dat")
WriteLine(ThisFile,SaveString$) //can use WriteString() to make "unreadable"
CloseFile(ThisFile)
EndIf
EndFunction
Интересный движок, наследник Дарк Бейсика, у них как раз распродажа в Стиме. Затарюсь.
Simulator GUI
// Project: simulator_GUI
// Created: 2025-06-25
// show all errors
SetErrorMode(2)
SetWindowTitle( "simulator_GUI" )
global Height
global Width
Height=GetMAXDeviceHeight()
Width=GetMAXDeviceWidth()
global W_H
W_H=trunc(Width/1024))
`Width=3840
`Height=2160
SetWindowSize( Width, Height, 1)
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( Width, Height ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
// set window properties
ru_en$="ru"
global game_On_spr
game_On_spr=CreateEditBox()
SetEditBoxPosition(game_On_spr,(Width/2-100*W_H), (Height/2-12*W_H))
info_button(game_On_spr,25,200)
if ru_en$="ru" then SetEditBoxText( game_On_spr, "Продолжить" )
if ru_en$="en" then SetEditBoxText( game_On_spr, "Continue" )
SetEditBoxVisible( game_On_spr, 1 )
do
v=0
X_Mouse=GetPointerX()
Y_Mouse=GetPointerY()
`SetSpritePosition( cursor, X_Mouse, Y_Mouse )
`SetSpritePosition( cursor_mouse, X_Mouse, Y_Mouse )
v=button(game_On_spr,200)
if v=1
`close_main_menu()
end
endif
Print( ScreenFPS() )
Sync()
loop
end
function info_button(info_button_1,size_q,line)
SetEditBoxVisible( info_button_1, 1 )
SetEditBoxActive( info_button_1, 0 )
SetEditBoxSize(info_button_1,line*W_H,size_q*W_H)
SetEditBoxTextSize(info_button_1,size_q*W_H)
SetEditBoxBackgroundColor( info_button_1, 0, 250, 0, 50 )
SetEditBoxBorderColor(info_button_1,0,250,0,50)
SetEditBoxTextColor( info_button_1, 0, 0, 0 )
SetEditBoxMaxChars( info_button_1, 50 )
SetEditBoxMultiLine( info_button_1, 0)
endfunction
function info_push_button(info_button_1,size_q,line)
SetEditBoxVisible( info_button_1, 1 )
SetEditBoxActive( info_button_1, 0 )
SetEditBoxSize(info_button_1,line*W_H,size_q*W_H)
SetEditBoxTextSize(info_button_1,size_q*W_H)
SetEditBoxBackgroundColor( info_button_1, 250, 0, 0, 50 )
SetEditBoxBorderColor(info_button_1,0,250,0,50)
SetEditBoxTextColor( info_button_1, 0,0, 0 )
SetEditBoxMaxChars( info_button_1, 50 )
SetEditBoxMultiLine( info_button_1, 0)
endfunction
function button(name_button,line)
X_Mouse=GetPointerX()
Y_Mouse=GetPointerY()
X_Object_On=GetEditBoxX( name_button )
Y_Object_On=GetEditBoxY( name_button )
info_button(name_button,25,line)
if X_Mouse>X_Object_On and X_Mouse<X_Object_On+line*W_H and Y_Mouse>Y_Object_On and Y_Mouse<Y_Object_On+25*W_H
info_push_button(name_button,25,line)
if GetPointerPressed()=1
`PlaySound( test_sound, sound_volume )
v=1
endif
endif
endfunction v
начну определение палитры цветов точки:
в начале программы надо создать массив :
dim colour[4]
Сама функция выглядит так:
function getcolour()
setspritevisible(cursor_mouse,0)
setspritevisible(cursor,0)
xx=GetPointerX()
yy=GetPointerY()
Render()
img = getimage(0,0,1,1)
ClearScreen()
mb = CreateMemblockFromImage(img)
colour[1] = GetMemblockbyte(mb,12)
colour[2] = GetMemblockbyte(mb,13)
colour[3] = GetMemblockbyte(mb,14)
colour[4] = GetMemblockbyte(mb,15)
DeleteImage(img)
DeleteMemblock(mb)
setspritevisible(cursor_mouse,1)
setspritevisible(cursor,1)
endfunction
вызов функции:
getcolour()
определение цветов в массиве:
red=colour[1]
green=colour[2]
blue=colour[3]
AppGameKit Classic не запускается, как починить?
Если эта программа после запуска сама закрывается.....???
здесь решение
white3
I had the same issue.
After blocking the connection of AppGameKit Classic it works as usual.
For Windows you can use the Windows Firewall.
Open "Windows Defender Firewall with Advanced Features" (see https://learn.microsoft.com/en-us/windows/security/operating-syst… nced-security for more info's) -> Click on Outbound Rules -> Create a New Rule -> in the "New Outbound Rule Wizard" select Program -> select <directory to your App Game Kit 2 installation>\Tier 1\Editor\bin\AGK.exe (e.g. C:\Program Files (x86)\Steam\steamapps\common\App Game Kit 2\Tier 1\Editor\bin\AGK.exe ) -> block connection.
Как создать и загружать свои скрипты для того,
чтобы менять некоторые параметры программы можно было бы из блокнота.
вот пример:
// Project: MARS
// Created: 2025-07-27
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Scripts" )
global Height ` высота экрана.
global Width `ширина экрана.
dim colour[4] ` объявляем переменные считывания цвета точки.
Height=240 `
Width=320
SetWindowSize( Width, Height, 1)
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( Width, Height ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
GLOBAL Device$ //Used to determine SaveSharedVariable or WriteLine/String()
Device$ = GetDeviceBaseName()
global SyncRateMax
If Device$ = "html5" or Device$ = "android"
SyncRateMax=120
Else
SyncRateMax=60
endif
SetSyncRate( SyncRateMax, 0 )
rem разгон
for t=1 to 100
screen=ScreenFPS()
fast$="fps="+str(screen)
fps111=screen
if fps111>60 then fps_11=fps_11-1
if fps111<60 then fps_11=fps_11+1
if fps_11>SyncRateMax then fps_11=SyncRateMax
SetSyncRate( fps_11, 0 )
print(fast$)
sync()
next t
rem---------------------------
rem меню универсал, агрузка
rem---------------------------
rem число окон меню
#include "main_menu.agc"
load_main_menu_from_file()
main_menu_make_menu()
do
main_menu_make_menu()
rem------------------------------
rem подгое ФПС под тормоза
rem------------------------------
screen=ScreenFPS()
`print("FPS="+str(screen) )
fps111=screen
if fps111>60 then fps_11=fps_11-1
if fps111<60 then fps_11=fps_11+1
if fps_11>SyncRateMax then fps_11=SyncRateMax
SetSyncRate( fps_11, 0 )
Sync()
loop
файл номер 2
Function load_main_menu_from_file()
global max_main_menu rem максимум строк для главного меню
global max_key_main_menu rem колличество кнопок
file_main_menu=OpenToRead( "main_menu.txt" )
t=1
max_key_main_menu=0
do
end_file$=ReadLine( file_main_menu )
print("load main menu - "+end_file$)
print(end_file$)
If GetStringToken(end_file$,"=", 1) = "new_key"
max_key_main_menu=max_key_main_menu+1
EndIf
sync()
if end_file$="end" then goto _exit_from_chek_end:
t=t+1
loop
_exit_from_chek_end:
CloseFile( file_main_menu )
max_main_menu=t-1
dim main_menu$[t]
dim count_key[max_key_main_menu]
file_main_menu=OpenToRead( "main_menu.txt" )
t=1
for t=1 to max_main_menu
file$=ReadLine( file_main_menu )
print("load main menu - "+file$)
sync()
main_menu$[t]=file$
next t
CloseFile( file_main_menu )
SetPrintFont( 0 ) rem чтобы работал ру шрифт
endfunction
function main_menu_make_menu()
key=0
for t=1 to max_main_menu
parametrs$=main_menu$[t]
print(parametrs$)
If GetStringToken(parametrs$,"=", 1) = "new_key"
new_key$ = GetStringToken(parametrs$,"=", 2)
key=key+1
print(key)
goto _next_parameter_main_menu:
EndIf
new_key$=""
_next_parameter_main_menu:
print(new_key$)
sync()
sleep(500)
next t
endfunction
сам файл txt для примера вот\
new_key=return_game
11
12
new_key=new_game
14
15
new_key=options
17
18
new_key=hiscore
20
end
пример меню
будет дополняться.
эскиз меню 2