Rorka Posted April 13, 2009 Posted April 13, 2009 Right, I want to make a Tile based game in Autoit... I have been messing around with it. and here's]what ive got! The glitches are obvious. (wont walk for a start) I have uploaded a Rar file as the images are needed. THIS IS NOT COMPLETE!!!poke.rar
exodius Posted April 13, 2009 Posted April 13, 2009 So first problem: $floor = GUICtrlCreatePic("C:\Users\Ashley\Desktop\poke\grass.bmp", 0, 0, 263, 173) $person = GUICtrlCreatePic("C:\Users\Ashley\Desktop\poke\Char\Charbk.gif", $Charleft, $Chartop, 32, 35)oÝ÷ Ø×vËhmæ®¶sbb33c¶fÆö÷"ÒuT7G&Ä7&VFU2gV÷C¶w&72æ&×gV÷C²ÂÂÂ#c2Âs2¢b33c·W'6öâÒuT7G&Ä7&VFU2gV÷C´6"b3#´6&&²ævbgV÷C²Âb33c´6&ÆVgBÂb33c´6'F÷Â3"Â3R
exodius Posted April 13, 2009 Posted April 13, 2009 (edited) Here's a bit of a touch-up on your work. Seems that the _IsPressed was catching both the down and up of the keypresses, so you'll want to use HotKeySet so it only catches one at a time. That and I made some improvements to your moving/sizing. expandcollapse popup#include <GUIConstants.au3> ;settings Global $GUI, $person, $person, $menuback, $Pokemonbut, $Usernamebut, $itemsbut Global $menu = 0 Global $varWindowWidth = 280 Global $varWindowHeight = 262 Global $Charleft = 0 Global $Chartop = 0 ;hotkeys HotKeySet("{enter}", "_Menu") HotKeySet("{left}", "_left") HotKeySet("{right}", "_right") HotKeySet("{up}", "_up") HotKeySet("{down}", "_down") #Region ### START Koda GUI section ### Form= $GUI = GUICreate("Pokemon game", $varWindowWidth, $varWindowHeight) $floor = GUICtrlCreatePic("grass.bmp", 0, 0, $varWindowWidth, $varWindowHeight) $person = GUICtrlCreatePic("Char\Charbk.gif", $Charleft, $Chartop, 35, 47) GUISetState(@SW_SHOW) #EndRegion ### START Koda GUI section ### Form= While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch ToolTip($Chartop & @CRLF & $Charleft & @CRLF & @CRLF & $varWindowHeight & @CRLF & $varWindowWidth, 0, 0) WEnd Func _menu() If $menu = 0 Then $menu = +1 $Pokemonbut = GUICtrlCreateButton("Pokemon", 170, 16, 75, 25, 0) $itemsbut = GUICtrlCreateButton("Items", 170, 48, 75, 25, 0) $Usernamebut = GUICtrlCreateButton(@UserName, 170, 80, 75, 25, 0) GUICtrlSetState($floor,$GUI_HIDE) GUICtrlSetState($person, $GUI_HIDE) Else $menu = 0 GUICtrlDelete($Pokemonbut) GUICtrlDelete($itemsbut) GUICtrlDelete($Usernamebut) GUICtrlSetState($floor, $GUI_SHOW) GUICtrlSetState($person, $GUI_SHOW) EndIf EndFunc ;==>_menu Func _left(); move left If $Charleft - 35 >= 0 Then $Charleft -= 35 GUICtrlSetPos($person, $Charleft, $Chartop) EndIf EndFunc ;==>_left Func _right(); move right If $Charleft + 70 <= $varWindowWidth Then $Charleft += 35 GUICtrlSetPos($person, $Charleft, $Chartop) EndIf EndFunc ;==>_right Func _up(); move up If $Chartop - 47 >= 0 Then $Chartop -= 47 GUICtrlSetPos($person, $Charleft, $Chartop) EndIf EndFunc ;==>_up Func _down(); move down If $Chartop + 94 <= $varWindowHeight Then $Chartop += 47 GUICtrlSetPos($person, $Charleft, $Chartop) EndIf EndFunc ;==>_down Edited April 13, 2009 by exodius
Rorka Posted April 14, 2009 Author Posted April 14, 2009 Thank you so much... Have you ever played pokemon? I want the menu, to have that kinda style? Also, im going to make the floor be tiles. So i need to to check for the map data file! and read the map from there. Cheers... Also it was to big.... so im made it smaller. here expandcollapse popup#include <GUIConstants.au3> ;settings Global $GUI, $person, $person, $menuback, $Pokemonbut, $Usernamebut, $itemsbut Global $menu = 0 Global $varWindowWidth = 263 Global $varWindowHeight = 173 Global $Charleft = 0 Global $Chartop = 0 ;hotkeys HotKeySet("{enter}", "_Menu") HotKeySet("{left}", "_left") HotKeySet("{right}", "_right") HotKeySet("{up}", "_up") HotKeySet("{down}", "_down") #Region ### START Koda GUI section ### Form= $GUI = GUICreate("Pokemon game", $varWindowWidth, $varWindowHeight) $floor = GUICtrlCreatePic("grass.bmp", 0, 0, $varWindowWidth, $varWindowHeight) $person = GUICtrlCreatePic("Char\Charbk.gif", $Charleft, $Chartop, 30, 37) GUISetState(@SW_SHOW) #EndRegion ### START Koda GUI section ### Form= While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch ToolTip($Chartop & @CRLF & $Charleft & @CRLF & @CRLF & $varWindowHeight & @CRLF & $varWindowWidth, 0, 0) WEnd Func _menu() If $menu = 0 Then $menu = +1 $Pokemonbut = GUICtrlCreateButton("Pokemon", 170, 16, 75, 25, 0) $itemsbut = GUICtrlCreateButton("Items", 170, 48, 75, 25, 0) $Usernamebut = GUICtrlCreateButton(@UserName, 170, 80, 75, 25, 0) Else $menu = 0 GUICtrlDelete($Pokemonbut) GUICtrlDelete($itemsbut) GUICtrlDelete($Usernamebut) EndIf EndFunc ;==>_menu Func _left(); move left If $Charleft - 35 >= 0 Then $Charleft -= 35 GUICtrlSetPos($person, $Charleft, $Chartop) EndIf EndFunc ;==>_left Func _right(); move right If $Charleft + 70 <= $varWindowWidth Then $Charleft += 35 GUICtrlSetPos($person, $Charleft, $Chartop) EndIf EndFunc ;==>_right Func _up(); move up If $Chartop - 47 >= 0 Then $Chartop -= 47 GUICtrlSetPos($person, $Charleft, $Chartop) EndIf EndFunc ;==>_up Func _down(); move down If $Chartop + 94 <= $varWindowHeight Then $Chartop += 47 GUICtrlSetPos($person, $Charleft, $Chartop) EndIf EndFunc ;==>_down Thank you
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now