Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.

Commit

Permalink
Update snowyPowerup.py
Browse files Browse the repository at this point in the history
Updated snowyPowerup.py to not let two portals open at the same position, added max portal number limits and changed the texture of the portal Powerup.
  • Loading branch information
Rahul Raman authored Jan 14, 2019
1 parent 6a8b75c commit a4a9cbe
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions mods/snowyPowerup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self):
self.powerupSound = bs.getSound("powerup01")
self.powerdownSound = bs.getSound("powerdown01")
self.dropSound = bs.getSound("boxDrop")
self.texPort = bs.getTexture("eyeColor")
self.texPort = bs.getTexture("ouyaOButton")

# material for powerups
self.powerupMaterial = bs.Material()
Expand Down Expand Up @@ -147,6 +147,10 @@ def __init__(self,position=(0,1,0),powerupType='tripleBombs',expire=True):
bs.gameTimer(defaultPowerupInterval-2500,bs.WeakCall(self._startFlashing))
bs.gameTimer(defaultPowerupInterval-1000,bs.WeakCall(self.handleMessage,bs.DieMessage()))

def delpor(self):
Portal.currentnum -= 1
self.port.delete()

def handleMessage(self,m):
self._handleMessageSanityCheck()

Expand Down Expand Up @@ -179,8 +183,18 @@ def handleMessage(self,m):
self.handleMessage(bs.DieMessage())
elif self.powerupType == 'portal':
t = bsSpaz.gPowerupWearOffTime
self.port = Portal.Portal(position1 = node.position,r = 0.9,color = (random.random(),random.random(),random.random()),activity = bs.getActivity())
bs.gameTimer(t,bs.Call(self.port.delete))
if Portal.currentnum < Portal.maxportals :
Portal.currentnum += 1
if self.node.position in Portal.lastpos :
self.port = Portal.Portal(position1 = None,r = 0.9,color = (random.random(),random.random(),random.random()),activity = bs.getActivity())
bs.gameTimer(t,bs.Call(self.delpor))
else :
m = self.node.position
Portal.lastpos.append(m)
self.port = Portal.Portal(position1 = self.node.position,r = 0.9,color = (random.random(),random.random(),random.random()),activity = bs.getActivity())
bs.gameTimer(t,bs.Call(self.delpor))
else :
bs.screenMessage('Only '+str(Portal.maxportals)+' pairs of portals are allowed at a time.')
self._powersGiven = True
self.handleMessage(bs.DieMessage())
else:
Expand Down

0 comments on commit a4a9cbe

Please sign in to comment.