Jump to content

How do I get a window inside a window to only stay in that window?


eynstyne
 Share

Recommended Posts

Reason? I'm making a game (Zombie Fries). The main character is just a window with a picture control in it. I have alot of character windows and I can't figure out why when I make the character jump using Winmove(), it jumps off my game screen! Also, If anybody has ANY ideas, questions,comments about/for the game performance or characters or game itself please post them. I really want to see my game come to life.

#include <e:\programming\autoit3 beta\include\GUIConstants.au3>
#include <e:\programming\autoit3 beta\include\misc.au3>
#include <e:\programming\autoit3 beta\include\date.au3>

;Fileinstall("g:\ScoreLCD.fon", @windowsdir & "\fonts\scoreLCD.fon")
;Fileinstall("g:\Shelldon.ttf", @windowsdir & "\fonts\Shelldon.ttf")

#Region ### START Koda GUI section ### Form=
dim $pic1, $zombie,$timer, $zombiecheat, $charpos, $range, $weapon, $picfire, $ammo, $mammo, $labelpoints, $itemcode, $fwin
dim $pic4, $pic5, $pic6, $pic7, $pic8, $pic9, $pic10, $pic11, $pic12, $pic13, $pichealth, $picbomb, $meter, $fryguy, $picplay, $label8
dim $zleft, $zright, $fryleft, $fryright
$Form1 = GUICreate("ZF", 538, 300, -1, -1, $WS_POPUP + $WS_DLGFRAME)

guisetbkcolor(0x000000,$form1)
$Pic1 = GUICtrlCreatePic(@scriptdir & "\ZF\ffhorror.bmp", 0, 0, 537, 300, 0)
if @error = 1 Then
    msgbox(16,"ZF","Couldn't load Title Screen")
    exit
 endif
$Label1 = GUICtrlCreateLabel("Zombie Fries", 137, 7, 330, 60,0)
GUICtrlSetFont(-1, 36, 800, 0, "Shelldon")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("New Game", 218, 89, 200, 26,-1)
GUICtrlSetFont(-1, 14, 800, 0, "Shelldon")
GUICtrlSetColor(-1, 0xFFFFFF)
guictrlsetcursor($label2,0)
$Label3 = GUICtrlCreateLabel("Load Game", 218, 120, 200, 26,-1)
GUICtrlSetFont(-1, 14, 800, 0, "Shelldon")
GUICtrlSetColor(-1, 0xFFFFFF)
guictrlsetcursor($label3,0)
$Label4 = GUICtrlCreateLabel("Save Game", 218, 150, 200, 26,-1)
GUICtrlSetFont(-1, 14, 800, 0, "Shelldon")
GUICtrlSetColor(-1, 0xFFFFFF)
guictrlsetcursor($label4,0)
$Label5 = GUICtrlCreateLabel("Instructions", 218, 180, 200, 26,-1)
GUICtrlSetFont(-1, 14, 800, 0, "Shelldon")
GUICtrlSetColor(-1, 0xFFFFFF)
guictrlsetcursor($label5,0)
$Label6 = GUICtrlCreateLabel("   Quit", 218, 215, 96, 200,-1)

guictrlsetcursor($label6,0)
GUICtrlSetFont($label6, 14, 800, 0, "Shelldon")
GUICtrlSetColor($label6, 0xFFFFFF)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

$i = 0
$timer = 30
$zombie = 0
$zombiecheat = 0
$o = 0
$p = 0
$fire = 0
$debug = 0
$cheating = 1
$range = .1
$weapon = @scriptdir & "\zf\fryguyattack.gif"
$ammo = 0
$mammo = 0
$zleft = 0
$zright = 0
$lvnum = 1
$difficulty = "Normal"

While 1
    
            
        
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $label6
            GUICtrlSetColor($label6, 0xFF0000)
sleep(200)
Exit
        case $label5
            GUICtrlSetColor($label5, 0xFF0000)
            
sleep(200)
GUICtrlSetColor($label5, 0xFFFFFF)
        case $label4
            GUICtrlSetColor($label4, 0xFF0000)
sleep(200)
GUICtrlSetColor($label4, 0xFFFFFF)
        case $label3
            GUICtrlSetColor($label3, 0xFF0000)
sleep(200)
GUICtrlSetColor($label3, 0xFFFFFF)
        case $label2
            GUICtrlSetColor($label2, 0xFF0000)
sleep(200)
restofgame()
EndSwitch
WEnd

func restofgame()
GUICtrlSetColor($label2, 0xFFFFFF)

    
controlhide("ZF","",$label3)
controlhide("ZF","",$label4)
controlhide("ZF","",$label5)
controlhide("ZF","",$label6)
guictrlsetimage($pic1,@scriptdir & "\ZF\ffhorrorgreyscale.bmp")
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Initialize Loading Screens")
    exit
    endif
    GUICtrlSetColor($label1, 0xFFffff)
guictrlsetdata($label2,"   Loading...")
GUICtrlSetcursor($label2, 15)
guictrlsetcursor($pic1,15)




Opt("guioneventmode",1)

$Picplay = GUICtrlCreatePic(@scriptdir & "\zf\bd1.bmp", 0, 0, 2000, 239, 0)
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Backdrop. Not enough Memory?")
    exit
endif
guictrlsetimage($pic1,"")
guictrlsetcursor($picplay,15)
controlhide("ZF","",$label2)
controlhide("ZF","",$label1)
$meter = GUICtrlCreatePic(@scriptdir & "\zf\meter3.bmp", 9, 254, 55, 25, 0)
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Health Meter")
    exit
endif

$Pichealth = GUICtrlCreatePic(@scriptdir & "\ZF\health.bmp", 186, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
GuictrlSetonevent(-1,"HealthPackUse")
guictrlsetcursor(-1,0)
controlhide("ZF","",$Pichealth)
$Labelhealth = GUICtrlCreateLabel("Health", 16, 277, 46, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Shelldon")
GUICtrlSetColor(-1, 0x00FF00)

$Labeletch = GUICtrlCreateLabel("ALabel2", 9, 248, 515, 2, $SS_ETCHEDHORZ)

$Labelpoints = GUICtrlCreateLabel("0000", 472, 256, 64, 22, 0)
GUICtrlSetFont(-1, 11, 400, 0, "VoyLCD")
GUICtrlSetColor(-1, 0x00FF00)

$Labelscore = GUICtrlCreateLabel("Score", 473, 278, 44, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Shelldon")
GUICtrlSetColor(-1, 0x00FF00)

$Labellevel = GUICtrlCreateLabel("Level 1", 219, 100, 110, 41)
GUICtrlSetFont(-1, 24, 800, 0, "Shelldon")
GUICtrlSetColor(-1, 0xFF0000)

$Labelname = GUICtrlCreateLabel("Streets", 226, 149, 85, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Shelldon")
GUICtrlSetColor(-1, 0xFF0000)
$Label8 = GUICtrlCreateLabel("3", 97, 253, 30, 28)
GUICtrlSetFont(-1, 16, 800, 0, "Shelldon")
GUICtrlSetColor(-1, 0xFF0000)

$Label9 = GUICtrlCreateLabel("Lives", 85, 276, 39, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Shelldon")
GUICtrlSetColor(-1, 0xFF0000)

$Label7 = GUICtrlCreateLabel("Items :", 126, 263, 58, 26)
GUICtrlSetFont(-1, 14, 400, 0, "Shelldon")
GUICtrlSetColor(-1, 0x00FF00)

$Pic4 = GUICtrlCreatePic(@scriptdir & "\zf\baz.bmp", 212, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: BAZ")
    exit
endif
controlhide("ZF","",$Pic4)
GuictrlSetonevent(-1,"bazUse")
guictrlsetcursor(-1,0)
$Pic5 = GUICtrlCreatePic(@scriptdir & "\zf\pepper.bmp", 238, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Pepper")
    exit
endif
controlhide("ZF","",$Pic5)
GuictrlSetonevent(-1,"pepperUse")
guictrlsetcursor(-1,0)
$Pic6 = GUICtrlCreatePic(@scriptdir & "\zf\ketchup.bmp", 264, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Ketchup")
    exit
endif
controlhide("ZF","",$Pic6)
GuictrlSetonevent(-1,"ketchupUse")
guictrlsetcursor(-1,0)
$Pic7 = GUICtrlCreatePic(@scriptdir & "\zf\ketchuppack.bmp", 290, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Ketchup_AMMO")
    exit
endif
controlhide("ZF","",$Pic7)
GuictrlSetonevent(-1,"packUse")
guictrlsetcursor(-1,0)
$Pic8 = GUICtrlCreatePic(@scriptdir & "\zf\mustard.bmp", 316, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Mustard")
    exit
endif
controlhide("ZF","",$Pic8)
GuictrlSetonevent(-1,"mustardUse")
guictrlsetcursor(-1,0)
$Pic9 = GUICtrlCreatePic(@scriptdir & "\zf\ketchupflamethrower.bmp", 342, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Ketchup_Flamethrower")
    exit
endif
controlhide("ZF","",$Pic9)
GuictrlSetonevent(-1,"ketchupflamethrowerUse")
guictrlsetcursor(-1,0)
$Pic11 = GUICtrlCreatePic(@scriptdir & "\zf\bandaid.bmp", 368, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Bandaid")
    exit
endif
controlhide("ZF","",$Pic11)
GuictrlSetonevent(-1,"bandaidUse")
guictrlsetcursor(-1,0)
$Picbomb = GUICtrlCreatePic(@scriptdir & "\zf\bomb.bmp", 394, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Bomb")
    exit
endif
controlhide("ZF","",$Picbomb)
GuictrlSetonevent(-1,"bombuse")
guictrlsetcursor(-1,0)
$Pic12 = GUICtrlCreatePic(@scriptdir & "\zf\code.bmp", 420, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Code")
    exit
endif
controlhide("ZF","",$Pic12)
GuictrlSetonevent(-1,"codeuse")
guictrlsetcursor(-1,0)
$Pic13 = GUICtrlCreatePic(@scriptdir & "\zf\key.bmp", 446, 263, 25, 23, BitOR($SS_NOTIFY,$WS_GROUP))
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Key")
    exit
endif
controlhide("ZF","",$Pic13)
GuictrlSetonevent(-1,"keyuse")
guictrlsetcursor(-1,0)

$getpos = wingetpos("ZF","")
$mc = guicreate("Main_Character",60,114,$getpos[0] + 11,$getpos[1] + 122,$WS_POPUP + $WS_CHILD, $WS_EX_TOOLWINDOW + $WS_EX_LAYERED + $WS_EX_TOPMOST, $form1)
$fryguy = GUICtrlCreatePic(@scriptdir & "\zf\fryguy.gif", 0, 0, 60, 114, -1)
if @error = 1 Then
    msgbox(16,"ZF","Couldn't load Sprite : Main_Character")
    exit
    endif
guisetstate(@SW_SHOW)

$itemcode = guicreate("ITEM_CodeSheet",135,50,-1,-1,$WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST + $WS_EX_LAYERED)
guictrlcreatepic(@scriptdir & "\ZF\Codesheet.bmp",0,0,135,50)
Guictrlsetonevent(-1,"CodeClick")
$var = Round(Random(0,9),0) & Round(Random(0,9),0) & Round(Random(0,9),0) & Round(Random(0,9),0)
guictrlcreatelabel($var, 35, 20, 150,30)
guictrlsetfont(-1,10,800, 2, "Shelldon")
guisetstate(@SW_HIDE)
$breakcode = guicreate("Code_Activate",135,50,-1,-1,$WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST + $WS_EX_LAYERED)
guictrlcreatepic(@scriptdir & "\ZF\Codesheet.bmp",0,0,135,50, 0)
$inp = GuictrlCreateinput("", 10, 20, 30, 20)
$inp2 = GuictrlCreateinput("", 40, 20, 30, 20)
$inp3 = GuictrlCreateinput("", 70, 20, 30, 20)
$inp4 = GuictrlCreateinput("", 100, 20, 30, 20)

$l1 = GUICtrlCreateUpdown($inp)
$l2 = GUICtrlCreateUpdown($inp2)
$l3 = GUICtrlCreateUpdown($inp3)
$l4 = GUICtrlCreateUpdown($inp4)

Guictrlsetlimit($l1, 9, 0)
Guictrlsetlimit($l2, 9, 0)
Guictrlsetlimit($l3, 9, 0)
Guictrlsetlimit($l4, 9, 0)

guisetstate(@SW_hide)

$wpos = wingetpos("Main_Character","")
$fwin = Guicreate("FIRE",25,23,$wpos[0] + 50,$ws_popup + 40,$WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW + $WS_EX_LAYERED)
$picfire = Guictrlcreatepic($weapon,0,0, 25,23, -1)
guisetstate(@sw_hide)
guictrlsetcursor($picplay,0)
sleep(2000)

controlhide("ZF","",$Labellevel)
controlhide("ZF","",$labelname)

hotkeyset("{lefT}","movesceneryleft")
hotkeyset("{RIGHT}","movesceneryright")

mainloop()
EndFunc


func mainloop()

while 2 

    if $zombie = 1 Then
        $begin = Timerinit()
do
        
        
  
          $dif = TimerDiff($begin)
        If $dif >= 30000 Then
            $timer = $timer - 1 
        endif
    
            If _ispressed("25","user32.dll") Then
                  $zleft = 1
                  $zright = 0
                    Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombieleft.gif")
                elseif _ispressed("27","user32.dll") Then
                    $zright = 1
                    $zleft = 0
                    Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombie.gif")
                EndIf
                
        
    
if _ispressed("44","user32.dll") Then       
if _ispressed("42","user32.dll") Then
    if _ispressed("55","user32.dll") Then
        if _ispressed("47","user32.dll") Then

            msgbox(64,"Debug Mode", "This feature is used to point out or troubleshoot problems within the game. This will provide coordinate info for certain items in the game." & @CRLF & "A message box like this one will show each time something is clicked providing detailed information about the object." & @CRLF & "Debug mode is ON. This mode cannot be exited from. Restart the game to resume normal play")
            $debug = 1
        EndIf
    EndIf
EndIf
EndIf



if _ispressed("71","user32.dll") Then
     if $debug = 1 then
        $cpos = controlgetpos("ZF","",$picplay)
    msgbox(0,"Backdrop Position","X:" & $cpos[0] & @CRLF & "Y:" & $cpos[1])
EndIf
EndIf

if _ispressed("72","user32.dll") Then
     if $debug = 1 then
        $char = wingetpos("Main_Character","")
    msgbox(0,"Main_Character Position","X:" & $char[0] & @CRLF & "Y:" & $char[1])
EndIf
EndIf

if _ispressed("73","user32.dll") Then
     if $debug = 1 then
        $cheating = 0
    msgbox(0,"Debug Mode","Cheats Disabled")
EndIf
EndIf

if _ispressed("74","user32.dll") Then
     if $debug = 1 then
        $cheating = 1
    msgbox(0,"Debug Mode","Cheats enabled")
EndIf
EndIf

if _ispressed("75","user32.dll") Then
     if $debug = 1 then
        
    guisetstate(@sw_hide,$mc)
EndIf
EndIf

if _ispressed("76","user32.dll") Then
     if $debug = 1 then
        
    guisetstate(@sw_show,$mc)
EndIf
EndIf
if _ispressed("77","user32.dll") Then
     if $debug = 1 then
        $mainwin = wingetpos("ZF","")
    msgbox(0,"Main_Win_Pos","X:" & $mainwin[0] & @CRLF & "Y:" & $mainwin[1])

EndIf
EndIf

if _ispressed("78","user32.dll") Then
     if $debug = 1 then
$range = $range + .1    

EndIf
EndIf

if _ispressed("79","user32.dll") Then
     if $debug = 1 then
$range = $range - .1

EndIf
EndIf

                if _ispressed("27","user32.dll") Then
        if _ispressed("11","user32.dll") Then
            
                
                $pos = wingetpos("Main_Character","")
            
                for $j = 1 to 100
                    for $h = .20 to 2
                        if _ispressed("12","user32.dll") Then
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombie.gif")
            sleep(50)
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombieblink.gif")
            sleep(50)
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombie.gif")
            EndIf
                    sleep($h)
                winmove("Main_Character","",$pos[0] + $j,$pos[1] - $j)
                controlmove("ZF","",$picplay, -$j, 0)
                
                next
            Next
            sleep(200)
            $pos = wingetpos("Main_Character","")

                    for $j = 1 to 100
for $h = .20 to 2
    
                    sleep($h)                       

            winmove("Main_Character","",$pos[0] + $j,$pos[1] + $j)
                        controlmove("ZF","",$picplay, -$j, 0)
        Next
        next
    EndIf
    EndIf

        If _ispressed("25","user32.dll") Then
        if _ispressed("11","user32.dll") Then
            
                        $pos = wingetpos("Main_Character","")
            
                for $j = 1 to 100
                    for $h = .20 to 2
                        if _ispressed("12","user32.dll") Then
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombie.gif")
            sleep(50)
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombieblink.gif")
            sleep(50)
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombie.gif")
            EndIf
                    sleep($h)
                winmove("Main_Character","",$pos[0] + $j,$pos[1] - $j)

                controlmove("ZF","",$picplay, -$j, 0)
                next
            Next
            sleep(200)
            $pos = wingetpos("Main_Character","")

                    for $j = 1 to 100
for $h = .20 to 2
    if _ispressed("12","user32.dll") Then
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombie.gif")
            sleep(50)
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombieblink.gif")
            sleep(50)
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombie.gif")
            EndIf
                    sleep($h)                       

            winmove("Main_Character","",$pos[0] + $j,$pos[1] + $j)
                        controlmove("ZF","",$picplay, -$j, 0)
        Next
    next
    
EndIf
EndIf


            
        If _ispressed("11","user32.dll") Then
            msgbox(0,"Jump","Jump")
            
            endif
    
        
           if _ispressed("5a","user32.dll") then
      if _ispressed("4f","user32.dll") then
      if _ispressed("4d","user32.dll") then
          if _ispressed("42","user32.dll") Then
          if $cheating = 1 then
                    $readscore = guictrlread($labelpoints)
            $readscore = $readscore + 200
            sleep(1000)
              guictrlsetdata($labelpoints, $readscore)

          if $zombiecheat = 1 then
                $zombiecheat = 0
                Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguy.gif")
elseif $zombiecheat = 0 then
          
        Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombie.gif")
        $zombiecheat = 1
          EndIf
          endif
      endif
  EndIf
  endif
  endif
          
 if _ispressed("4d","user32.dll") then
      if _ispressed("41","user32.dll") then
      if _ispressed("53","user32.dll") then
                if _ispressed("48","user32.dll") then
            if $cheating = 1 then
          $read = guictrlread($label8)
            $read = $read + 1
            sleep(1000)
              guictrlsetdata($label8, $read)
              
               $readscore = guictrlread($labelpoints)
            $readscore = $readscore + 500
        
              guictrlsetdata($labelpoints, $readscore)
      EndIf
  EndIf
  endif
  EndIf
  endif
  
  if _ispressed("53","user32.dll") then
      if _ispressed("50","user32.dll") then
      if _ispressed("55","user32.dll") then
          if _ispressed("44","user32.dll") then
              if _ispressed("5a","user32.dll") then
          if $cheating = 1 then
          
Guictrlsetimage($meter, @scriptdir & "\ZF\meter5.bmp")
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load health meter")
    exit
endif
               $readscore = guictrlread($labelpoints)
            $readscore = $readscore + 1000
            sleep(1000)
              guictrlsetdata($labelpoints, $readscore)
controlshow("ZF","",$Pichealth)
    controlshow("ZF","",$Pic7)
        controlshow("ZF","",$Pic6)
        controlshow("ZF","",$Pic9)
        controlshow("ZF","",$Pic8)
        controlshow("ZF","",$Pic4)
        controlshow("ZF","",$Pic5)
        controlshow("ZF","",$Pic11)
        controlshow("ZF","",$Picbomb)
        controlshow("ZF","",$Pic12)
        controlshow("ZF","",$Pic13)
        
endif
      EndIf
  EndIf
  EndIf
  endif
  endif


           until $timer = 0
            $zombie = 0
            
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguy.gif")
            if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Main_Character")
    exit
endif
endif

    





            If _ispressed("25","user32.dll") Then
                $fryright = 0
$fryleft = 1
                    Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguyleft.gif")
                elseif _ispressed("27","user32.dll") Then
$fryleft = 0
$fryright = 1
                    Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguy.gif")
                EndIf
        
if _ispressed("44","user32.dll") Then       
if _ispressed("42","user32.dll") Then
    if _ispressed("55","user32.dll") Then
        if _ispressed("47","user32.dll") Then

            msgbox(64,"Debug Mode", "This feature is used to point out or troubleshoot problems within the game. This will provide coordinate info for certain items in the game." & @CRLF & "A message box like this one will show each time something is clicked providing detailed information about the object." & @CRLF & "Debug mode is ON. This mode cannot be exited from. Restart the game to resume normal play")
            $debug = 1
        EndIf
    EndIf
EndIf
EndIf



if _ispressed("71","user32.dll") Then
     if $debug = 1 then
        $cpos = controlgetpos("ZF","",$picplay)
    msgbox(0,"Backdrop Position","X:" & $cpos[0] & @CRLF & "Y:" & $cpos[1])
EndIf
EndIf

if _ispressed("72","user32.dll") Then
     if $debug = 1 then
        $char = wingetpos("Main_Character","")
    msgbox(0,"Main_Character Position","X:" & $char[0] & @CRLF & "Y:" & $char[1])
EndIf
EndIf

if _ispressed("73","user32.dll") Then
     if $debug = 1 then
        $cheating = 0
    msgbox(0,"Debug Mode","Cheats Disabled")
EndIf
EndIf

if _ispressed("74","user32.dll") Then
     if $debug = 1 then
        $cheating = 1
    msgbox(0,"Debug Mode","Cheats enabled")
EndIf
EndIf

if _ispressed("75","user32.dll") Then
     if $debug = 1 then
        
    guisetstate(@sw_hide,$mc)
EndIf
EndIf

if _ispressed("76","user32.dll") Then
     if $debug = 1 then
        
    guisetstate(@sw_show,$mc)
EndIf
EndIf
if _ispressed("77","user32.dll") Then
     if $debug = 1 then
        $mainwin = wingetpos("ZF","")
    msgbox(0,"Main_Win_Pos","X:" & $mainwin[0] & @CRLF & "Y:" & $mainwin[1])

EndIf
EndIf

if _ispressed("78","user32.dll") Then
     if $debug = 1 then
$range = $range + .1    

EndIf
EndIf

if _ispressed("79","user32.dll") Then
     if $debug = 1 then
$range = $range - .1

EndIf
EndIf
        if _ispressed("27","user32.dll") Then
        if _ispressed("11","user32.dll") Then
            
                
                $pos = wingetpos("Main_Character","")
        
                for $j = 1 to 100
                    for $h = .20 to 2
                    sleep($h)
                    $j = $j + 5
                winmove("Main_Character","",$pos[0] + $j,$pos[1] - $j)
                controlmove("ZF","",$picplay, -$j, 0)
                
                next
            Next
            sleep(200)
            $pos = wingetpos("Main_Character","")

                    for $j = 1 to 100
for $h = .20 to 2
    $j = $j + 5
                    sleep($h)                       

            winmove("Main_Character","",$pos[0] + $j,$pos[1] + $j)
                        controlmove("ZF","",$picplay, -$j, 0)
        Next
    next
EndIf
EndIf

        If _ispressed("25","user32.dll") Then
        if _ispressed("11","user32.dll") Then
            
                            $pos = wingetpos("Main_Character","")
            
                for $j = 1 to 100
                    for $h = .20 to 2
                        $j = $j + 5
                    sleep($h)
                    
                winmove("Main_Character","",$pos[0] - $j,$pos[1] - $j)
                if $pos >= 0 then
                controlmove("ZF","",$picplay, $j, 0)
                endif
                next
            Next
            sleep(200)
            $pos = wingetpos("Main_Character","")

                    for $j = 1 to 100
for $h = .20 to 2
                    sleep($h)                       

            winmove("Main_Character","",$pos[0] - $j,$pos[1] + $j)
            if $pos <= 0 then
                        controlmove("ZF","",$picplay, $j, 0)
                        endif
        Next
    next
    
EndIf
EndIf
        
        if _ispressed("12","user32.dll") Then
            if $ammo = 0 then
                Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguyattack.gif")
                sleep(50)
        
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguy.gif")
        
            
            elseif $weapon = @scriptdir & "\ZF\msplat.gif" Then
                    guictrlsetimage($picfire, $weapon)
                    $mammo = $mammo + 1
Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguyattackmustard.gif")
                    sleep(50)
Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguyattackmustard2.gif")   
sleep(50)
Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguyattackmustard.gif")
                elseif $weapon = @scriptdir & "\ZF\ksplat.gif" Then
                    guictrlsetimage($picfire, $weapon)
            $ammo = $ammo - 1
            Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguyfire.gif")
sleep(50)
Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguyfire2.gif")
endif
        
$wpos = wingetpos("Main_Character","")
$zfpos = wingetpos("ZF","")
for $i = 1 to $zfpos[0] + 50
$wpos = wingetpos("Main_Character","")
    winmove("FIRE","",($wpos[0] + 50) + $i, $wpos[1] + 40)
    Guisetstate(@sw_show, $fwin)
    sleep($range)
    

Next
Guisetstate(@sw_hide, $fwin)

Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguy.gif")

        EndIf
    
        
           if _ispressed("5a","user32.dll") then
      if _ispressed("4f","user32.dll") then
      if _ispressed("4d","user32.dll") then
          if _ispressed("42","user32.dll") Then
          if $cheating = 1 then
                    $readscore = guictrlread($labelpoints)
            $readscore = $readscore + 200
            sleep(1000)
              guictrlsetdata($labelpoints, $readscore)

          if $zombiecheat = 1 then
                $zombiecheat = 0
                Guictrlsetimage($fryguy, @scriptdir & "\ZF\fryguy.gif")
elseif $zombiecheat = 0 then
          
        Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombie.gif")
        $zombiecheat = 1
          EndIf
          endif
      endif
  EndIf
  endif
  endif
          
 if _ispressed("4d","user32.dll") then
      if _ispressed("41","user32.dll") then
      if _ispressed("53","user32.dll") then
                if _ispressed("48","user32.dll") then
            if $cheating = 1 then
          $read = guictrlread($label8)
            $read = $read + 1
            sleep(1000)
              guictrlsetdata($label8, $read)
              
               $readscore = guictrlread($labelpoints)
            $readscore = $readscore + 500
        
              guictrlsetdata($labelpoints, $readscore)
      EndIf
  EndIf
  endif
  EndIf
  endif
  
  if _ispressed("53","user32.dll") then
      if _ispressed("50","user32.dll") then
      if _ispressed("55","user32.dll") then
          if _ispressed("44","user32.dll") then
              if _ispressed("5a","user32.dll") then
          if $cheating = 1 then
          
Guictrlsetimage($meter, @scriptdir & "\ZF\meter5.bmp")
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load health meter")
    exit
endif
               $readscore = guictrlread($labelpoints)
            $readscore = $readscore + 1000
            sleep(1000)
              guictrlsetdata($labelpoints, $readscore)
controlshow("ZF","",$Pichealth)
    controlshow("ZF","",$Pic7)
        controlshow("ZF","",$Pic6)
        controlshow("ZF","",$Pic9)
        controlshow("ZF","",$Pic8)
        controlshow("ZF","",$Pic4)
        controlshow("ZF","",$Pic5)
        controlshow("ZF","",$Pic11)
        controlshow("ZF","",$Picbomb)
        controlshow("ZF","",$Pic12)
        controlshow("ZF","",$Pic13)
        
endif
      EndIf
  EndIf
  EndIf
  endif
  endif
;$msg = Guigetmsg()
;Switch

;endswitch
    wend

endfunc


func movesceneryleft()

    hotkeyset("{righT}", "movesceneryright")
    $pos = controlgetpos("ZF","",$picplay)
    $i = $i + 5
    if $pos[0] = 0 then
    hotkeyset("{LEFT}")
    
EndIf

    controlmove("ZF","",$picplay, $i, 0)
    
EndFunc

func movesceneryright()

    hotkeyset("{lefT}", "movesceneryleft")
$pos = controlgetpos("ZF","",$picplay)
    $i = $i - 5
    if $pos[0] <= -1450 then
    hotkeyset("{RIGHT}")
    
    EndIf
    controlmove("ZF","",$picplay, $i, 0)
    
EndFunc



func HealthPackUse()
controlhide("ZF","",$Pichealth)
Guictrlsetimage($meter, @scriptdir & "\ZF\meter5.bmp")
if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load health meter")
    exit
    endif
EndFunc

func packUse()
    controlhide("ZF","",$Pic7)
    $ammo = $ammo + 10
EndFunc

func ketchupUse()
        controlhide("ZF","",$Pic6)
        $weapon = @scriptdir & "\ZF\ksplat.gif"
EndFunc

func ketchupflamethrowerUse()
        controlhide("ZF","",$Pic9)
EndFunc

func mustardUse()
        controlhide("ZF","",$Pic8)
        $weapon = @scriptdir & "\ZF\Msplat.gif"
        $damage = 30
EndFunc

func bazUse()
        controlhide("ZF","",$Pic4)
        Guictrlsetimage($fryguy, @scriptdir & "\ZF\zombie.gif")
        if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load Sprite: Main_Character as Zombie")
    exit
    endif
$zombie = 1

EndFunc

func pepperUse()
        controlhide("ZF","",$Pic5)
    EndFunc
    
    func bandaidUse()
        controlhide("ZF","",$Pic11)
        Guictrlsetimage($meter, @scriptdir & "\ZF\meter5.bmp")
        if @error = 1 Then
    msgbox(16,"ZF","Couldn't Load health meter")
    exit
    endif
    EndFunc
    
    func bombUse()
        controlhide("ZF","",$Picbomb)
        
    EndFunc
    func codeUse()
        controlhide("ZF","",$Pic12)

    guisetstate(@SW_SHOW, $itemcode)
sleep(3000)
        guisetstate(@sw_HIDE, $itemcode)
    
    
    EndFunc
    func keyUse()
        controlhide("ZF","",$Pic13)
        
    EndFunc
    
    func CodeClick()
    
        guisetstate(@sw_HIDE, $itemcode)
        
        
    EndFunc

This is not completely finished...

Thanks in advance... :)

Edited by eynstyne
F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

Tried it as child window before. It didn't seem to work. Oh..Also it is set as topmost so my character doesn't disappear off the window...

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

Forget about my idea, it doesn't quite behave as what I'd expect from a MDI window...

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

Ok. Then I have other things to fix like how I can get my character to jump in an arc path rather than just a perfect triangle. It looks kinda stupid.

The Firing Rate and why it fires so slow. (Fixed, but not edited in post) - Any better ways to do this?

When it jumps to the left, backdrop doesn't scroll with it.

When in jump mode, when it fires it pauses the jump

I can only bind a CTRL -> to be a jump to right, but I could make it so that it when jump is hit, left and right arrows will move the character slightly. (More control)

Disable Windows Sounds or just turn down the volume temporarily when pressing the cheat code combinations.

When the zombie cheat code is pressed, Zombie will appear but when pressing a left or right button the mode will deactivate

YEP...This is lots of work for me, but I will have tons of time from the beginning to the end of the school year.

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

I thought of it, but I didn't know what would be better. Which takes more memory. The window or a whole bunch of controls in one window. Would it slow down more?

What would work better. If an enemy touches the Window or control it subtracts a health point. Which is easier to sense that something has touched it?

Used a window because of transparency ($WS_EX_LAYERED)

How could make a control transparent. Do I need $GUI_BKCOLOR_TRANSPARENT style?

Edited by eynstyne
F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
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...