Example #1
0
 def Initialize(self, initializer):
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
     Zero.Connect(self.Owner, Events.CollisionStarted, self.OnCollision)
     self.Target = 0
     self.FrontDirection = Vec3(random.uniform(-10, 10), random.uniform(-10, 10), 0)
Example #2
0
 def Initialize(self, initializer):
     self.Callback = None
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
Example #3
0
 def Initialize(self, initializer):
     self.soultick = 0
     Zero.Connect(self.Owner, "heroClickEvent", self.OnHeroClick)
    def Initialize(self, initializer):

        #Create Update event
        Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)

        #------------------------------------------------------------------
        #Setting Variables

        #This is the timer for adding the score
        self.levelProgression = 0.0
        #This sets beginning score from time to 0
        self.startTimeScore = 0
        #This sets beginning score from Gold to 0
        self.startGoldScore = 0
        #This sets beginning score from deaths to 0
        self.startDeathScore = 0

        #------------------------------------------------------------------

        #for live calculating of score
        self.deathsAreDone = False
        self.timeIsDone = False
        self.goldIsDone = False

        #checks to display stats immediately or end level
        self.getStats = False
        self.endLevel = False

        #your total score for the level
        self.LevelFinalScore = 0

        #Get your final time and level par from level just completed
        self.finalTime = Zero.Game.Score.finalTime
        self.par = Zero.Game.Score.par

        #Get final deaths from level just completed
        self.finalDeaths = Zero.Game.Score.finalDeaths

        #Get final gold from level just completed
        self.finalGold = Zero.Game.Score.finalGold

        #------------------------------------------------------------------
        #Calculations:

        #Calculate time score
        if (self.finalTime < self.par):
            self.tscore = (round(self.par - self.finalTime)) * 100
        else:
            self.tscore = 0
        #Calculate gold score
        self.tgold = self.finalGold * 200
        #Calculate Death score
        self.tdeath = self.finalDeaths * 100
        #calculate final score
        self.LevelFinalScore = self.tscore + self.tgold - self.tdeath
        self.Owner.AddComponentByName("SaveHighscore")

        #------------------------------------------------------------------

        #for file i/o for checking game progress
        self.UserDirect = Zero.GetUserDirectory()
        self.filename = "save.txt"

        #------------------------------------------------------------------
        #setting up checks that win screens have been achieved

        self.WinTutorial = False
        self.WinDougMode = False
        self.WinAdventure = False
        self.WinDaredevil = False
        self.WinAll = False
Example #5
0
 def Initialize(self, initializer):
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
Example #6
0
 def Initialize(self, initializer):
     self.CurrentUpdate = self.UpUpdate
     self.camera = self.Space.FindObjectByName("Camera")
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
Example #7
0
 def Initialize(self, initializer):
     self.Tracker = self.Space.FindObjectByName("Player")
     self.MouseIndicator = self.Space.FindObjectByName("MouseIndicator")
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
Example #8
0
    def Initialize(self, initializer):
        self.Activatable = True if not self.ActivateWhenTargetDestroyed else False
        
        self.hider = self.Space.CreateAtPosition("WhiteDot",self.Owner.Transform.Translation)
        self.hider.AttachToRelative(self.Owner)
        
        if self.EmphasizeStart >= 0 and self.EmphasizeEnd >= self.EmphasizeStart:
            self.emphasizer = self.Space.CreateAtPosition("WhiteDot",self.Owner.Transform.Translation)
        else:
            self.emphasizer = None
        
        self.visual_soul = None    
        if self.CreateVisual:
            self.visual_soul = self.Space.CreateAtPosition("VisualSoul", self.Owner.Transform.Translation + self.Owner.Collider.Offset)
            self.visual_soul.SpriteParticleSystem.Tint = self.VisualCueColor
            self.init_emit_rate = self.visual_soul.SphericalParticleEmitter.EmitRate
            
        self.Reset()

        self.destroy_registered = False            
        self.CurrentUpdate = self.TextBoxUpdate
        
        self.playSuccessful = False
        
        self.soul_size_changed = False
        
        if self.CollisionActivate:
            self.Active = False
            Zero.Connect(self.Owner, Events.CollisionStarted, self.OnCollision)
            Zero.Connect(self.Owner, Events.CollisionEnded, self.OnCollisionEnded)
        
        if self.CharsPerLine:
            fontheight = self.TestFontSize().y
            fontwidth = self.TestFontSize().x
            
            boxheight = math.ceil(len(self.String) / self.CharsPerLine) * fontheight
            boxwidth = self.CharsPerLine * fontwidth
            self.Owner.SpriteText.Size = VectorMath.Vec2(boxwidth, boxheight)
        
        if self.ActivateWhenTargetDestroyed:
            self.Active = False
                
            if self.visual_soul:
                self.visual_soul.SphericalParticleEmitter.EmitRate = 0
            
            def activate():
                if self.visual_soul:
                    self.visual_soul.SphericalParticleEmitter.EmitRate = self.init_emit_rate
                self.Activatable=True
                if self.ImmediatePlayMessage:
                    self.Play()
                
            if self.ActivateWhenTargetDestroyed.KeyHoleDoor:
                self.ActivateWhenTargetDestroyed.KeyHoleDoor.RegisterObserver(activate)
            elif self.ActivateWhenTargetDestroyed.DestroyInterface:
                print("Registered")
                self.ActivateWhenTargetDestroyed.DestroyInterface.RegisterObserver(activate)
            elif self.ActivateWhenTargetDestroyed.ClickReceiver:
                self.ActivateWhenTargetDestroyed.ClickReceiver.RegisterObserver(activate)
                
        self.touched = False
        
        Zero.Connect(self.Space,Events.LogicUpdate, self.OnLogicUpdate)
    def Initialize(self, initializer):

        self.yvalue = -5.5

        #Checks if there is a volume text file and creates one if it doesn't exist
        if os.path.exists(Zero.GetUserDirectory() +
                          "Castellum") and os.path.isfile(
                              Zero.GetUserDirectory() +
                              "Castellum\\volume_options.txt"):

            #opens file for reading
            self.file = open(
                Zero.GetUserDirectory() + "Castellum\\" + "volume_options.txt",
                'r+')
            #reads in value after converting it to an integer
            self.percent = int(self.file.readline())
            #closes file
            self.file.close()

        elif os.path.exists(Zero.GetUserDirectory() + "Castellum"):
            #opens file for writing
            self.file = open(
                Zero.GetUserDirectory() + "Castellum\\" + "volume_options.txt",
                'w')
            #writes to fiile 100 (max volume)
            self.file.write("100")
            #closes file
            self.file.close()
            #re-Intitializes script so we can check to read file
            self.Initialize(initializer)

        else:
            #Creating a file if there wasn't one
            os.mkdir(Zero.GetUserDirectory() + "Castellum")
            self.file = open(
                Zero.GetUserDirectory() + "Castellum\\" + "volume_options.txt",
                'w')
            #writes to file 100 (max Volume)
            self.file.write("100")
            #Closes file
            self.file.close()
            #re-Intitializes script so we can check to read file
            self.Initialize(initializer)

        self.currentSpace = 0
        #Max left and right movement
        self.x_left = -3.125
        self.x_right = 3.155
        #Total length of movement
        self.total = -self.x_left + self.x_right
        #sets it to what the percent is
        self.Owner.Transform.Translation = VectorMath.Vec3(
            self.x_left + (self.percent * self.total / 100.0), self.yvalue, -1)
        #finds volume and sets text
        self.volume = self.Space.FindObjectByName("Volume")
        self.volume.SpriteText.Text = "Volume: " + str(round(
            self.percent)) + "%"

        self.clicked = False

        #camera varaible
        cameracog = self.Space.FindObjectByName("Camera")

        #setting up mouse events
        Zero.Connect(self.Owner, Events.MouseDown, self.onMouseDown)
        Zero.Connect(self.Owner, Events.MouseUp, self.onMouseUp)
        Zero.Connect(cameracog.Camera.Viewport, Events.MouseMove,
                     self.onMouseMove)
        Zero.Connect(cameracog.Camera.Viewport, Events.MouseUpdate,
                     self.onMouseUpdate)
Example #10
0
 def Initialize(self, initializer):
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
     Zero.Connect(self.Space, Events.MouseUpdate, self.OnMouseUpdate)
     Zero.Connect(self.Space, Events.MouseDown, self.OnMouseDown)
     self.gameCamera = self.Space.FindObjectByName("Camera")
Example #11
0
 def Initialize(self, initializer):
     Zero.Connect(self.Owner, Events.CollisionStarted, self.OnCollision)
     self.TryKeyEvent = Zero.ScriptEvent()
     self.TryKeyEvent.Callback = lambda: self.OpenDoor()
     
     self.TryKeyEvent.KeyHole = self.KeyHole
Example #12
0
 def Initialize(self, initializer):
     self.StartFreezing = False
     self.FreezeCounter = 0
     self.Activated = False
     Zero.Connect(self.Owner, Events.CollisionStarted, self.OnCollision)
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
Example #13
0
 def Initialize(self, initializer):
     self.tracked = None
     if self.TrackedName:
         self.tracked = self.Space.FindObjectByName(self.TrackedName)
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
Example #14
0
 def Initialize(self, initializer):
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
     Zero.Connect(self.Owner, Events.CollisionStarted, self.OnCollisionStart)
     Zero.Connect(self.Owner, Events.CollisionEnded, self.OnCollisionEnd)
     self.Player = self.Space.FindObjectByName("Player")
     self.PlayerShadow = self.Player.FindChildByName("PlayerShadow")
Example #15
0
 def Initialize(self, initializer):
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
     Zero.Connect(self.Owner, Events.CollisionStarted, self.OnCollisionStarted)
Example #16
0
 def Initialize(self, initializer):
     Zero.Connect(self.Owner, "BurnEvent", self.OnBurn)
     self.sequence = None
Example #17
0
 def Initialize(self, initializer):
     self.CheckPoint = self.Space.FindObjectByName("CheckPoint")
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
Example #18
0
 def Initialize(self, initializer):
     self.burnanim = None
     Zero.Connect(self.Space, Events.LogicUpdate, self.OnLogicUpdate)
Example #19
0
 def Initialize(self, initializer):
     if not self.Owner.FreezeAnim:
         self.Owner.AddComponentByName("FreezeAnim")
     
     Zero.Connect(self.Owner, Events.CollisionStarted, self.OnCollision)
Example #20
0
 def Initialize(self, initializer):
     
     Zero.Connect(self.Owner, "TriggerEvent", self.OnTrigger)
Example #21
0
 def Initialize(self, initializer):
     Zero.Connect(self.Owner, Events.CollisionStarted, self.OnCollision)
Example #22
0
 def Initialize(self, initializer):
     Zero.Connect(self.Owner, "BounceEvent", self.OnBounce)