Jump to content

Simple Problem Help Please


Recommended Posts

#include <GUIConstantsEx.au3> ;must
#include <StaticConstants.au3> ;must
#include <WindowsConstants.au3> ;must


Global $Game = GUICreate("Human Movement", 700, 500)
Global $x = 50
Global $y = 380
Global $Head = GUICtrlCreateGraphic($x, $y)
Global $Body = GUICtrlCreateGraphic($x, $y+30)
Global $Arm = GUICtrlCreateGraphic($x+8, $y+40)
Global $Leg1 = GUICtrlCreateGraphic($x-12, $y+80)
Global $Leg2 = GUICtrlCreateGraphic($x-10, $y+80)


GUISetBkColor(0xBFE3FE) ;Background color

HumanCreationR() 
GroundCreation()
SkyCreation()
LadderCreation()
WoodenFloorCreation()


HotkeySet("{Right}", "East")
Func East()
    GuiCtrlDelete($Head)
    GuiCtrlDelete($Body)
    GuiCtrlDelete($Arm)
    GuiCtrlDelete($Leg1)
    GuiCtrlDelete($Leg2)
    $x = $x + 30
    HumanCreationR();Right side image

EndFunc



HotkeySet("{Left}", "West")
Func West()
    GuiCtrlDelete($Head)
    GuiCtrlDelete($Body)
    GuiCtrlDelete($Arm)
    GuiCtrlDelete($Leg1)
    GuiCtrlDelete($Leg2)
    $x = $x - 30
    HumanCreationL();Left side image

    
EndFunc

HotKeySet("{Up}", "North")
Func North()
    If $x > 550 AND $x < 590 AND $y > 200 Then ;Makes it so that you can only go up if you are on the ladder
    GuiCtrlDelete($Head)
    GuiCtrlDelete($Body)
    GuiCtrlDelete($Arm)
    GuiCtrlDelete($Leg1)
    GuiCtrlDelete($Leg2)
    $y = $y - 55 ;Human's height is 110 so has to be multiple of 110
    HumanCreationR()
    EndIf
EndFunc

HotKeySet("{Down}", "South")
Func South()
    If $y < 330 Then
    GuiCtrlDelete($Head)
    GuiCtrlDelete($Body)
    GuiCtrlDelete($Arm)
    GuiCtrlDelete($Leg1)
    GuiCtrlDelete($Leg2)
    $y = $y + 55 ;Human's height is 110 so has to be multiple of 110
    HumanCreationR()
    EndIf
EndFunc
    
    





GUISetState(@SW_SHOW)  ;must
   While 1        ;must                  
    
$nMsg = GUIGetMsg() ;must
Switch $nMsg ;must
Case $GUI_EVENT_CLOSE ;must
    Exit ;must
        


Func HumanCreationR()      

$Head = GUICtrlCreateGraphic($x, $y)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xCCCCCC) ;The color of the shape 
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, 30, 30) ;The shape of the shape(Circle) (-1, $GUI_GR_ELLIPSE, X, Y, Width, Height) X,Y MUST BE THE SAME AS THE X,Y OF THE GUICTRLCREATEGRAPHIC
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Body = GUICtrlCreateGraphic($x, $y+30)
GuiCtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, 20, 50)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Arm = GUICtrlCreateGraphic($x+8, $y+15)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 10, 30)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Leg1 = GUICtrlCreateGraphic($x-12, $y+80)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GuiCtrlSetGraphic(-1, $GUI_GR_LINE, 20, 0)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Leg2 = GUICtrlCreateGraphic($x-10, $y+80)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 40, 30)
GUICtrlSetStyle(-1, $SS_NOTIFY) ;A must in order for images to show correctly 
EndFunc


Func HumanCreationL()      

$Head = GUICtrlCreateGraphic($x-10, $y)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xCCCCCC) ;The color of the shape 
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, 30, 30) ;The shape of the shape(Circle) (-1, $GUI_GR_ELLIPSE, X, Y, Width, Height) X,Y MUST BE THE SAME AS THE X,Y OF THE GUICTRLCREATEGRAPHIC
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Body = GUICtrlCreateGraphic($x, $y+30)
GuiCtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, 20, 50)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Arm = GUICtrlCreateGraphic($x-40, $y+15)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 10, 30)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Leg1 = GUICtrlCreateGraphic($x-12, $y+80)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GuiCtrlSetGraphic(-1, $GUI_GR_LINE, 20, 0)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Leg2 = GUICtrlCreateGraphic($x-10, $y+80)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 40, 30)
GUICtrlSetStyle(-1, $SS_NOTIFY) ;A must in order for images to show correctly 
EndFunc



Func GroundCreation()
    
$Grass = GUICtrlCreateGraphic(0, 0)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0x66FF33)
GUICtrlSetGraphic(-1, $Gui_GR_RECT, 0, 490, 700, 10) ; (x,y,width,length)


GUICtrlSetStyle(-1, $SS_NOTIFY)
EndFunc

Func SkyCreation()
    
$Cloud = GUICtrlCreateGraphic(0, 0)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0xFFFFFF, 0xFFFFFF) ;(Color of outline, Color of object)
GUICtrlSetGraphic(-1, $Gui_GR_Ellipse, 30, 30, 80, 40)
GUICtrlSetGraphic(-1, $Gui_GR_Ellipse, 30, 50, 30, 30)
GUICtrlSetGraphic(-1, $Gui_GR_Ellipse, 50, 40, 50, 40)

GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 180, 80, 80, 40)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 180, 80, 40, 60)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 160, 70, 40, 60)

GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 380, 80, 180, 40)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 380, 80, 80, 80)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 360, 70, 80, 60)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 420, 90, 80, 60)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 430, 60, 80, 100)

$Sun = GUICtrlCreateGraphic(600, 0)
GuiCtrlSetGraphic(-1, $Gui_GR_Color, 0xFFFF00, 0xFFFF00)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 0, 0, 90, 90)


EndFunc

Func LadderCreation()
    $Ladder = GUICtrlCreateGraphic(0, 0)
    GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0xFF3333, 0xFF3333)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 550, 270, 5, 220)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 590, 270, 5, 220)
    
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 470, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 440, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 410, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 380, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 350, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 320, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 290, 43, 2)
    
EndFunc

Func WoodenFloorCreation()
    $WoodenFloor = GUICtrlCreateGraphic(0, 0)
    GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0x996600, 0x996600)
    GuiCtrlSetGraphic(-1, $Gui_GR_Rect, 593, 270, 107, 12)

EndFunc

EndSwitch ;must
Wend ;must

How do I make it so that when my character moves out of the map, then a new map appears. I want to make more maps D=.

Edited by BlazerV60
Link to comment
Share on other sites

#include <GUIConstantsEx.au3> ;must
#include <StaticConstants.au3> ;must
#include <WindowsConstants.au3> ;must


Global $Game = GUICreate("Human Movement", 700, 500)
Global $x = 50
Global $y = 380
Global $Head = GUICtrlCreateGraphic($x, $y)
Global $Body = GUICtrlCreateGraphic($x, $y+30)
Global $Arm = GUICtrlCreateGraphic($x+8, $y+40)
Global $Leg1 = GUICtrlCreateGraphic($x-12, $y+80)
Global $Leg2 = GUICtrlCreateGraphic($x-10, $y+80)


GUISetBkColor(0xBFE3FE) ;Background color

HumanCreationR() 
GroundCreation()
SkyCreation()
LadderCreation()
WoodenFloorCreation()


HotkeySet("{Right}", "East")
Func East()
    GuiCtrlDelete($Head)
    GuiCtrlDelete($Body)
    GuiCtrlDelete($Arm)
    GuiCtrlDelete($Leg1)
    GuiCtrlDelete($Leg2)
    $x = $x + 30
    HumanCreationR();Right side image

EndFunc



HotkeySet("{Left}", "West")
Func West()
    GuiCtrlDelete($Head)
    GuiCtrlDelete($Body)
    GuiCtrlDelete($Arm)
    GuiCtrlDelete($Leg1)
    GuiCtrlDelete($Leg2)
    $x = $x - 30
    HumanCreationL();Left side image

    
EndFunc

HotKeySet("{Up}", "North")
Func North()
    If $x > 550 AND $x < 590 AND $y > 200 Then ;Makes it so that you can only go up if you are on the ladder
    GuiCtrlDelete($Head)
    GuiCtrlDelete($Body)
    GuiCtrlDelete($Arm)
    GuiCtrlDelete($Leg1)
    GuiCtrlDelete($Leg2)
    $y = $y - 55 ;Human's height is 110 so has to be multiple of 110
    HumanCreationR()
    EndIf
EndFunc

HotKeySet("{Down}", "South")
Func South()
    If $y < 330 Then
    GuiCtrlDelete($Head)
    GuiCtrlDelete($Body)
    GuiCtrlDelete($Arm)
    GuiCtrlDelete($Leg1)
    GuiCtrlDelete($Leg2)
    $y = $y + 55 ;Human's height is 110 so has to be multiple of 110
    HumanCreationR()
    EndIf
EndFunc
    
    





GUISetState(@SW_SHOW) ;must
 While 1 ;must 
    
$nMsg = GUIGetMsg() ;must
Switch $nMsg ;must
Case $GUI_EVENT_CLOSE ;must
    Exit ;must
        


Func HumanCreationR() 

$Head = GUICtrlCreateGraphic($x, $y)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xCCCCCC) ;The color of the shape 
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, 30, 30) ;The shape of the shape(Circle) (-1, $GUI_GR_ELLIPSE, X, Y, Width, Height) X,Y MUST BE THE SAME AS THE X,Y OF THE GUICTRLCREATEGRAPHIC
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Body = GUICtrlCreateGraphic($x, $y+30)
GuiCtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, 20, 50)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Arm = GUICtrlCreateGraphic($x+8, $y+15)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 10, 30)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Leg1 = GUICtrlCreateGraphic($x-12, $y+80)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GuiCtrlSetGraphic(-1, $GUI_GR_LINE, 20, 0)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Leg2 = GUICtrlCreateGraphic($x-10, $y+80)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 40, 30)
GUICtrlSetStyle(-1, $SS_NOTIFY) ;A must in order for images to show correctly 
EndFunc


Func HumanCreationL() 

$Head = GUICtrlCreateGraphic($x-10, $y)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xCCCCCC) ;The color of the shape 
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, 30, 30) ;The shape of the shape(Circle) (-1, $GUI_GR_ELLIPSE, X, Y, Width, Height) X,Y MUST BE THE SAME AS THE X,Y OF THE GUICTRLCREATEGRAPHIC
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Body = GUICtrlCreateGraphic($x, $y+30)
GuiCtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, 20, 50)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Arm = GUICtrlCreateGraphic($x-40, $y+15)
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 10, 30)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Leg1 = GUICtrlCreateGraphic($x-12, $y+80)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GuiCtrlSetGraphic(-1, $GUI_GR_LINE, 20, 0)
GUICtrlSetStyle(-1, $SS_NOTIFY)

$Leg2 = GUICtrlCreateGraphic($x-10, $y+80)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0xCCCCCC)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 40, 30)
GUICtrlSetStyle(-1, $SS_NOTIFY) ;A must in order for images to show correctly 
EndFunc



Func GroundCreation()
    
$Grass = GUICtrlCreateGraphic(0, 0)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0, 0x66FF33)
GUICtrlSetGraphic(-1, $Gui_GR_RECT, 0, 490, 700, 10) ; (x,y,width,length)


GUICtrlSetStyle(-1, $SS_NOTIFY)
EndFunc

Func SkyCreation()
    
$Cloud = GUICtrlCreateGraphic(0, 0)
GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0xFFFFFF, 0xFFFFFF) ;(Color of outline, Color of object)
GUICtrlSetGraphic(-1, $Gui_GR_Ellipse, 30, 30, 80, 40)
GUICtrlSetGraphic(-1, $Gui_GR_Ellipse, 30, 50, 30, 30)
GUICtrlSetGraphic(-1, $Gui_GR_Ellipse, 50, 40, 50, 40)

GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 180, 80, 80, 40)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 180, 80, 40, 60)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 160, 70, 40, 60)

GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 380, 80, 180, 40)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 380, 80, 80, 80)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 360, 70, 80, 60)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 420, 90, 80, 60)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 430, 60, 80, 100)

$Sun = GUICtrlCreateGraphic(600, 0)
GuiCtrlSetGraphic(-1, $Gui_GR_Color, 0xFFFF00, 0xFFFF00)
GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 0, 0, 90, 90)


EndFunc

Func LadderCreation()
    $Ladder = GUICtrlCreateGraphic(0, 0)
    GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0xFF3333, 0xFF3333)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 550, 270, 5, 220)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 590, 270, 5, 220)
    
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 470, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 440, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 410, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 380, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 350, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 320, 43, 2)
    GuiCtrlSetGraphic(-1, $Gui_GR_Ellipse, 551, 290, 43, 2)
    
EndFunc

Func WoodenFloorCreation()
    $WoodenFloor = GUICtrlCreateGraphic(0, 0)
    GUICtrlSetGraphic(-1, $Gui_GR_COLOR, 0x996600, 0x996600)
    GuiCtrlSetGraphic(-1, $Gui_GR_Rect, 593, 270, 107, 12)

EndFunc

EndSwitch ;must
Wend ;must

How do I make it so that when my character moves out of the map, then a new map appears. I want to make more maps D=.

From this post and this post, it appears you can write scripts with user-defined functions inside a loop.

How do you do it?

And what does " ;must" mean?

Very strange.

Link to comment
Share on other sites

I tried out your code, but was unable to get started because there are a few errors.

First from Tidy:

>"C:\Program Files\AutoIt3\SciTE\tidy\tidy.exe" "C:\Users\Jos\Desktop\somegame.au3"
Tidy AutoIt3 v2.0.29.0   Copyright (c) Jos van der Zande  October 19, 2009
C:\Users\Jos\Desktop\somegame.au3(97) : ### Tidy Error -> "case" Not closed before "Func" statement.
C:\Users\Jos\Desktop\somegame.au3(97) : ### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
C:\Users\Jos\Desktop\somegame.au3(128) : ### Tidy Error -> "case" Not closed before "Func" statement.
C:\Users\Jos\Desktop\somegame.au3(128) : ### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
C:\Users\Jos\Desktop\somegame.au3(160) : ### Tidy Error -> "case" Not closed before "Func" statement.
C:\Users\Jos\Desktop\somegame.au3(160) : ### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
C:\Users\Jos\Desktop\somegame.au3(172) : ### Tidy Error -> "case" Not closed before "Func" statement.
C:\Users\Jos\Desktop\somegame.au3(172) : ### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
C:\Users\Jos\Desktop\somegame.au3(199) : ### Tidy Error -> "case" Not closed before "Func" statement.
C:\Users\Jos\Desktop\somegame.au3(199) : ### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
C:\Users\Jos\Desktop\somegame.au3(217) : ### Tidy Error -> "case" Not closed before "Func" statement.
C:\Users\Jos\Desktop\somegame.au3(217) : ### Tidy Error -> "func" cannot be inside any IF/Do/While/For/Case/Func statement.
!> there were  12 error(s) encountered. look in your source for:### Tidy Error:
+> Tidy AutoIt3 finished. Original copied to:"C:\Users\Jos\Desktop\BackUp\somegame_old1.au3"
>Exit code: 12    Time: 0.952

Then from Au3Check:

C:\Users\Jos.DUO-IT\Desktop\somegame.au3(97,4) : ERROR: missing EndSwitch.
            Func
            ^
C:\Users\Jos.DUO-IT\Desktop\somegame.au3(89,20) : REF: missing EndSwitch.
    Switch $nMsg ;must
    ~~~~~~~~~~~~~~~~~~^
C:\Users\Jos.DUO-IT\Desktop\somegame.au3(97,4) : ERROR: missing Wend.
            Func
            ^
C:\Users\Jos.DUO-IT\Desktop\somegame.au3(86,1) : REF: missing Wend.
While
^
C:\Users\Jos.DUO-IT\Desktop\somegame.au3(224,2) : ERROR: syntax error
    EndSwitch
    ^
C:\Users\Jos.DUO-IT\Desktop\somegame.au3 - 3 error(s), 0 warning(s)

Anyway, the answer for loading more maps is you need map loading system. ( HURR DURR XD )

There are some articles and examples on http://gamedev.net/

Link to comment
Share on other sites

First off I would like to thank Malkey for fixing my orange ball movement program. After I got his code, i tweaked my orange ball movement program a bit with his code in mind and got it to work =D. And thx manadar for the link =D. And um Tbh Idk why my code doesnt work on your guy's computer D=, thats gonna be a problem for if i post more code in the future here D=.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...