Pinmiks don't give score when selected

This commit is contained in:
theo@manjaro 2021-09-20 13:37:25 +02:00
parent 5ccbfdb219
commit 8fb7914d91
5 changed files with 29 additions and 1 deletions

BIN
gamedata/assets/handle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
gamedata/assets/jamlogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -68,7 +68,8 @@ class Manager(BaseObject):
# Updating score
if not self.game.globals["pause"]:
for lemming in lemmings:
self.score+=lemming.scoreratio*self.game.dt
if not lemming.selected:
self.score+=lemming.scoreratio*self.game.dt
# Pausing the game
if self.game.inputs["keys"]["escape"]["timer"]==1:
self.game.globals["pause"] = not self.game.globals["pause"]

19
gamedata/objects/link.py Normal file
View File

@ -0,0 +1,19 @@
from gamedata.objects.base import BaseObject
import webbrowser
class Link(BaseObject):
def __init__(self,x,y,game,image,link):
super().__init__(x,y,game,w=image.get_width(),h=image.get_height())
self.sprite = image
self.link = link
def step(self):
if self.rect.collidepoint(self.game.inputs["mouse"]["pos"]):
if self.game.inputs["mouse"]["click"]==1:
webbrowser.open(self.link)

View File

@ -11,6 +11,7 @@ from gamedata.objects.ingame.skies import Skies
from gamedata.objects.ingame.clouds import Clouds
from gamedata.objects.resetbutton import Reset
from gamedata.objects.rescalebutton import Rescale
from gamedata.objects.link import Link
def main(game):
game.scaleCamera()
@ -23,9 +24,15 @@ def main(game):
game.gameloop.summon(cloudsdark)
game.gameloop.summon(clouds)
menu = MainMenu(game.DISPLAY_WIDTH/4,round(game.DISPLAY_HEIGHT*3/8),game,game.DISPLAY_WIDTH//2,game.DISPLAY_HEIGHT//2)
spr = game.sprite_lib["jamlogo.png"]
jamicon = Link(0,game.DISPLAY_HEIGHT-spr.get_height(),game,spr,"https://itch.io/jam/vimjam2")
spr = game.sprite_lib["handle.png"]
name = Link(game.DISPLAY_WIDTH-spr.get_width(),game.DISPLAY_HEIGHT-spr.get_height(),game,spr,"https://justayte.itch.io")
game.gameloop.summon(skies)
game.gameloop.summon(bg)
game.gameloop.summon(menu)
game.gameloop.summon(jamicon)
game.gameloop.summon(name)
def ingame(game):
game.gameloop.reinit()
@ -38,6 +45,7 @@ def ingame(game):
def options(game):
game.gameloop.delname("Button")
game.gameloop.delname("MainMenu")
game.gameloop.delname("Link")
game.globals["camerax"] = 0
game.globals["cameray"] = 0
s = BGMSlider(40,40,game,400,40)