Группа :: Игры/Прочее
Пакет: slingshot
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: 243aef95dde390f97f1e0abbbdb646b3e5b97f7d.patch
Скачать
Скачать
From 243aef95dde390f97f1e0abbbdb646b3e5b97f7d Mon Sep 17 00:00:00 2001
From: Indrit Bashkimi <indrit.bashkimi@gmail.com>
Date: Thu, 26 Mar 2020 22:11:29 +0100
Subject: [PATCH] Port from Python 2 to Python 3
---
README | 4 +--
setup.py | 2 +-
src/bin/slingshot | 26 +++++++--------
src/slingshot/general.py | 10 +++---
src/slingshot/inputbox.py | 6 ++--
src/slingshot/menu.py | 60 ++++++++++++++++-----------------
src/slingshot/network.py | 12 +++----
src/slingshot/particle.py | 70 +++++++++++++++++++--------------------
src/slingshot/planet.py | 36 ++++++++++----------
src/slingshot/player.py | 12 +++----
src/slingshot/settings.py | 8 ++---
11 files changed, 122 insertions(+), 124 deletions(-)
diff --git a/README b/README
index 9636bc9..75ef6be 100644
--- a/README
+++ b/README
@@ -19,8 +19,8 @@ v0.9:
--- Requirements ---
-python 2.4 (or higher) http://www.python.org/
-python-pygame 1.7.1 (or higher) http://www.pygame.org/
+python 3.0 (or higher) http://www.python.org/
+python-pygame 1.9.2 (or higher) http://www.pygame.org/
--- Installation ---
diff --git a/setup.py b/setup.py
index 92072b6..db6b69d 100755
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
# Copyright (C) 2010 Ryan Kavanagh <ryanakca@kubuntu.org>
#
# Slingshot is free software; you can redistribute it and/or modify
diff --git a/src/bin/slingshot b/src/bin/slingshot
index 68185fb..6a44b89 100644
--- a/src/bin/slingshot
+++ b/src/bin/slingshot
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
# This file is part of Slingshot.
#
# Slingshot is a two-dimensional strategy game where two players attempt to shoot one
@@ -37,7 +37,7 @@ import math
import os
import sys
import time
-import thread
+import _thread as thread
from random import randint
diff --git a/src/slingshot/general.py b/src/slingshot/general.py
index e6b6c22..ddea114 100644
--- a/src/slingshot/general.py
+++ b/src/slingshot/general.py
@@ -30,12 +30,12 @@
from slingshot.settings import Settings
def load_image(name, colorkey=None):
- fullname = os.path.join(Settings.DATA_PATH, name)
+ fullname = os.path.join(Settings.DATA_PATH, name)
try:
image = pygame.image.load(fullname)
- except pygame.error, message:
- print 'Cannot load image:', fullname
- raise SystemExit, message
+ except pygame.error as message:
+ print('Cannot load image:', fullname)
+ raise SystemExit(message)
image = image.convert_alpha()
if colorkey is not None:
if colorkey is -1:
@@ -87,7 +87,7 @@ def get_intersect(center, r, pos1, pos2):
return pos
def get_data_path(file):
- return os.path.join(Settings.DATA_PATH, file)
+ return os.path.join(Settings.DATA_PATH, file)
def prep_text(text, antialias, font, linespacing, color):
'''
diff --git a/src/slingshot/inputbox.py b/src/slingshot/inputbox.py
index e6012e7..1dd22f5 100644
--- a/src/slingshot/inputbox.py
+++ b/src/slingshot/inputbox.py
@@ -33,7 +33,7 @@ def __init__(self, screen, question):
self.screen = screen
self.question = question
self.new_str = []
- self.input_box(question + ": " + string.join(self.new_str,""))
+ self.input_box(question + ": " + "".join(self.new_str))
def input_box(self, msg):
pygame.draw.rect(self.screen, (0,0,0),
@@ -61,8 +61,8 @@ def ask(self):
return False
elif key <= 127 and len(self.new_str) < 19:
self.new_str.append(chr(key))
- self.input_box(self.question + ": " + string.join(self.new_str,""))
- return string.join(self.new_str,"")
+ self.input_box(self.question + ": " + "".join(self.new_str))
+ return "".join(self.new_str)
def get_key(self):
while 1:
diff --git a/src/slingshot/menu.py b/src/slingshot/menu.py
index 04a6d24..7b1e30e 100644
--- a/src/slingshot/menu.py
+++ b/src/slingshot/menu.py
@@ -35,10 +35,10 @@ def __init__(self, name, dim = True, copyright = False):
self.dim = dim
self.count = 0
self.inc = 15
- self.copyright = copyright
+ self.copyright = copyright
def change_active(self, item, a):
- for i in xrange(0, self.items.__len__()):
+ for i in range(0, self.items.__len__()):
if self.items[i][0] == item:
self.items[i] = (self.items[i][0], self.items[i][1], self.items[i][2], a)
@@ -100,8 +100,8 @@ def draw(self):
result = pygame.Surface((w, h))
#result.fill((100,0,0))
result.blit(Settings.menu_background, (0,0))
- if self.copyright:
- for line, (x, y) in prep_text([
+ if self.copyright:
+ for line, (x, y) in prep_text([
"Slingshot is:",
" Copyright (C) 2007 Jonathan Musther <jmusther@gmail.com>",
" Copyright (C) 2007 Bart Mak",
@@ -123,14 +123,13 @@ def draw(self):
"Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA",
"",
"http://github.com/ryanakca/slingshot"],
- True, Settings.fineprint, 0, (10, 10, 10)):
- # We want our text to start at 20px from the left
- # side and 305 px from the top.
- result.blit(line, (20, 305 + y))
- version = Settings.fineprint.render(
- 'Version '+ Settings.VERSION, True,
- (230, 230, 230))
- result.blit(version, (345 - version.get_width(), 3))
+ True, Settings.fineprint, 0, (10, 10, 10)):
+ # We want our text to start at 20px from the left
+ # side and 305 px from the top.
+ result.blit(line, (20, 305 + y))
+ version = Settings.fineprint.render(
+ 'Version '+ Settings.VERSION, True, (230, 230, 230))
+ result.blit(version, (345 - version.get_width(), 3))
txt = Settings.menu_font.render(self.name, 1, (255,255,255))
rect = txt.get_rect()
@@ -138,7 +137,7 @@ def draw(self):
result.blit(txt, rect.topleft)
n = self.items.__len__()
- for i in xrange(0, n):
+ for i in range(0, n):
if i == self.selected:
color = (self.count,self.count,255)
else:
@@ -191,24 +190,23 @@ class Welcome(Menu):
def __init__(self):
Menu.__init__(self, "")
- self.img = pygame.surface.Surface((600, 300), pygame.SRCALPHA)
+ self.img = pygame.surface.Surface((600, 300), pygame.SRCALPHA)
self.choice = ""
- # header font
- hfont = pygame.font.Font(get_data_path("FreeSansBold.ttf"), 40)
- header = prep_text(["Welcome to Slingshot!"], True, hfont,
- 0, (255, 255, 255))[0]
- self.img.blit(header[0],
- ((self.img.get_width() - header[1][0]) / 2, 0)
- )
- # Instructions font
- ifont = pygame.font.Font(get_data_path("FreeSansBold.ttf"), 15)
- instructions = prep_text(
- ["Press space to play or escape for the menu and help!"],
- True, ifont, 0, (255, 255, 255))[0]
- self.img.blit(instructions[0],
- ((self.img.get_width() - instructions[1][0]) / 2, 60)
- )
- for line, (x, y) in prep_text([
+ # header font
+ hfont = pygame.font.Font(get_data_path("FreeSansBold.ttf"), 40)
+ header = prep_text(["Welcome to Slingshot!"], True, hfont, 0, (255, 255, 255))[0]
+ self.img.blit(header[0],
+ ((self.img.get_width() - header[1][0]) / 2, 0)
+ )
+ # Instructions font
+ ifont = pygame.font.Font(get_data_path("FreeSansBold.ttf"), 15)
+ instructions = prep_text(
+ ["Press space to play or escape for the menu and help!"],
+ True, ifont, 0, (255, 255, 255))[0]
+ self.img.blit(instructions[0],
+ ((self.img.get_width() - instructions[1][0]) / 2, 60)
+ )
+ for line, (x, y) in prep_text([
"Slingshot is:",
" Copyright (C) 2007 Jonathan Musther <jmusther@gmail.com>",
" Copyright (C) 2007 Bart Mak",
@@ -326,7 +324,7 @@ def draw(self):
rect.midtop = (w / 2, Settings.MENU_LINEFEED + offset)
result.blit(txt, rect.topleft)
- for i in xrange(0, 2):
+ for i in range(0, 2):
if i == self.selected:
color = (self.count,self.count,255)
else:
diff --git a/src/slingshot/network.py b/src/slingshot/network.py
index 6af5775..8ea6d64 100644
--- a/src/slingshot/network.py
+++ b/src/slingshot/network.py
@@ -42,7 +42,7 @@ def wait_for_cnct(self):
af, socktype, proto, canonname, sa = res
try:
connect_s = socket.socket(af, socktype, proto)
- except socket.error, msg:
+ except socket.error as msg:
connect_s = None
continue
try:
@@ -50,12 +50,12 @@ def wait_for_cnct(self):
connect_s.bind(sa)
connect_s.listen(1)
connect_s.settimeout(2)
- except socket.error, msg:
+ except socket.error as msg:
connect_s.close()
connect_s = None
continue
break
- except socket.error, msg:
+ except socket.error as msg:
connect_s = None
if connect_s is None:
@@ -77,18 +77,18 @@ def cnct(self, hostname):
af, socktype, proto, canonname, sa = res
try:
self.s = socket.socket(af, socktype, proto)
- except socket.error, msg:
+ except socket.error as msg:
self.s = None
continue
try:
self.s.settimeout(3)
self.s.connect(sa)
- except socket.error, msg:
+ except socket.error as msg:
self.s.close()
self.s = None
continue
break
- except socket.error, msg:
+ except socket.error as msg:
self.s = None
if self.s is None:
diff --git a/src/slingshot/particle.py b/src/slingshot/particle.py
index cd875bb..1541663 100644
--- a/src/slingshot/particle.py
+++ b/src/slingshot/particle.py
@@ -32,7 +32,7 @@
class Particle(pygame.sprite.Sprite):
def __init__(self, pos = (0.0, 0.0), size = 10):
- ''' Initialize the particle. '''
+ ''' Initialize the particle. '''
pygame.sprite.Sprite.__init__(self)
if size == 5:
self.image = Settings.particle_image5
@@ -59,7 +59,7 @@ def max_flight(self):
return False
def update(self, planets):
- """
+ """
Updates information about ourselves, namely our location.
@param planets: list of planets
@@ -70,7 +70,7 @@ def update(self, planets):
1 otherwise
@rtype: int
- """
+ """
self.flight = self.flight - 1
self.last_pos = self.pos
@@ -78,20 +78,20 @@ def update(self, planets):
for p in planets:
p_pos = p.get_pos()
mass = p.get_mass()
- dx = self.pos[0] - p_pos[0]
- dy = self.pos[1] - p_pos[1]
+ dx = self.pos[0] - p_pos[0]
+ dy = self.pos[1] - p_pos[1]
d = dx**2 + dy**2
- # a is the acceleration in pixels/tick
- # -> [ G * m_p * \delta d_x G * m_p * \delta d_y ]
- # a = [ ---------------------- , ---------------------- ]
- # [ r ^ (1/3) r ^ (1/3) ]
- try:
- a = ((Settings.g * mass * dx) / (d * math.sqrt(d)), (Settings.g * mass * dy) / (d * math.sqrt(d)))
- except ZeroDivisionError:
- # Hackishly take any silly particles out of the game.
- a = (10000, 10000)
- # It's been a tick, update our velocity according to our
- # acceleration
+ # a is the acceleration in pixels/tick
+ # -> [ G * m_p * \delta d_x G * m_p * \delta d_y ]
+ # a = [ ---------------------- , ---------------------- ]
+ # [ r ^ (1/3) r ^ (1/3) ]
+ try:
+ a = ((Settings.g * mass * dx) / (d * math.sqrt(d)), (Settings.g * mass * dy) / (d * math.sqrt(d)))
+ except ZeroDivisionError:
+ # Hackishly take any silly particles out of the game.
+ a = (10000, 10000)
+ # It's been a tick, update our velocity according to our
+ # acceleration
self.v = (self.v[0] - a[0], self.v[1] - a[1])
self.pos = (self.pos[0] + self.v[0], self.pos[1] + self.v[1])
@@ -102,19 +102,19 @@ def update(self, planets):
for p in planets:
p_pos = p.get_pos()
r = p.get_radius()
- # d is not the distance from the planet, it's the distance squared.
+ # d is not the distance from the planet, it's the distance squared.
d = (self.pos[0] - p_pos[0])**2 + (self.pos[1] - p_pos[1])**2
- if p.type == "Blackhole":
- min_dist = p.get_mass()
- if d <= min_dist:
- self.impact_pos = p_pos
- self.pos = self.impact_pos
- return -1
- elif d <= (r)**2:
- # This is a planet
- self.impact_pos = get_intersect(p_pos, r, self.last_pos, self.pos)
- self.pos = self.impact_pos
- return 0
+ if p.type == "Blackhole":
+ min_dist = p.get_mass()
+ if d <= min_dist:
+ self.impact_pos = p_pos
+ self.pos = self.impact_pos
+ return -1
+ elif d <= (r)**2:
+ # This is a planet
+ self.impact_pos = get_intersect(p_pos, r, self.last_pos, self.pos)
+ self.pos = self.impact_pos
+ return 0
if Settings.BOUNCE:
if self.pos[0] > 799:
@@ -146,10 +146,10 @@ def in_range(self):
return False
def visible(self):
- """
- Returns whether or not the particle is within the playing area.
+ """
+ Returns whether or not the particle is within the playing area.
- """
+ """
if pygame.Rect(0, 0, 800, 600).collidepoint(self.pos):
return True
else:
@@ -186,7 +186,7 @@ def launch(self, player):
def update_players(self, players):
result = 1
- for i in xrange(10):
+ for i in range(10):
pos = (self.last_pos[0] + i * 0.1 * self.v[0], self.last_pos[1] + i * 0.1 * self.v[1])
if players[1].hit(pos):
result = 0
@@ -215,9 +215,9 @@ def draw_status(self, screen):
def update(self, planets, players):
result = Particle.update(self, planets)
result = result * self.update_players(players)
- # Draws the missile's trajectory only if we haven't entered a black hole.
- if result != -1:
- pygame.draw.aaline(self.trail_screen, self.trail_color, self.last_pos, self.pos)
+ # Draws the missile's trajectory only if we haven't entered a black hole.
+ if result != -1:
+ pygame.draw.aaline(self.trail_screen, self.trail_color, self.last_pos, self.pos)
return result
def get_image(self):
diff --git a/src/slingshot/planet.py b/src/slingshot/planet.py
index a6da9db..7626506 100644
--- a/src/slingshot/planet.py
+++ b/src/slingshot/planet.py
@@ -31,10 +31,10 @@
from slingshot.general import *
class Planet(pygame.sprite.Sprite):
- """ A planet sprite """
+ """ A planet sprite """
def __init__(self, planets, background, n=None, radius=None, mass=None, pos=None):
- """
+ """
Initialize a Planet.
@param planets: list of Planets
@@ -54,7 +54,7 @@ def __init__(self, planets, background, n=None, radius=None, mass=None, pos=None
"""
pygame.sprite.Sprite.__init__(self)
- self.type = "Planet"
+ self.type = "Planet"
if n == None and planets != None:
unique = False
@@ -75,8 +75,8 @@ def __init__(self, planets, background, n=None, radius=None, mass=None, pos=None
positioned = False
while not positioned:
self.mass = randint(8,512)
- # radius is between 25 and 100 when mass is
- # between 8 and 512
+ # radius is between 25 and 100 when mass is
+ # between 8 and 512
self.r = self.mass**(1.0/3.0) * 12.5
self.pos = (randint(Settings.PLANET_SHIP_DISTANCE + round(self.r), 800 - Settings.PLANET_SHIP_DISTANCE - round(self.r)), randint(Settings.PLANET_EDGE_DISTANCE + round(self.r), 600 - Settings.PLANET_EDGE_DISTANCE - round(self.r)))
positioned = True
@@ -129,15 +129,15 @@ def fade(self, f):
# self.image.set_at((randint(0, round(self.r * 2)), randint(0, round(self.r * 2))), (0,0,0,0))
class Blackhole(Planet):
- def __init__(self, planets, background, n=None, radius=None, mass=None, pos=None):
+ def __init__(self, planets, background, n=None, radius=None, mass=None, pos=None):
pygame.sprite.Sprite.__init__(self)
- self.type = "Blackhole"
+ self.type = "Blackhole"
- self.image = pygame.surface.Surface((2, 2))
- self.image.fill((0,0,0))
- self.image.set_alpha(0)
- self.rect = self.image.get_rect()
+ self.image = pygame.surface.Surface((2, 2))
+ self.image.fill((0,0,0))
+ self.image.set_alpha(0)
+ self.rect = self.image.get_rect()
if n == None and planets != None:
unique = False
@@ -153,7 +153,7 @@ def __init__(self, planets, background, n=None, radius=None, mass=None, pos=None
if radius == None or mass == None or pos == None:
positioned = False
while not positioned:
- # We can't accurately represent blackholes in
+ # We can't accurately represent blackholes in
# this game. According to my (feeble)
# understanding of the Schwarzschild radius, to
# have a radius of 1m and be a black hole, we'd
@@ -162,7 +162,7 @@ def __init__(self, planets, background, n=None, radius=None, mass=None, pos=None
# our largest planet.
self.mass = randint(600, 700)
self.r = 1 # radius
- # Slightly more distance from the sides than
+ # Slightly more distance from the sides than
# planets because of our massive gravit.
# field.
self.pos = (randint(3 * Settings.PLANET_SHIP_DISTANCE + round(self.r),
@@ -179,10 +179,10 @@ def __init__(self, planets, background, n=None, radius=None, mass=None, pos=None
self.r = radius
self.pos = pos
- self.orig = self.image
- self.rect = self.orig.get_rect()
+ self.orig = self.image
+ self.rect = self.orig.get_rect()
self.rect.center = self.pos
- def fade(self, f):
- """ Don't mess with our alpha, we're invilible! """
- pass
+ def fade(self, f):
+ """ Don't mess with our alpha, we're invilible! """
+ pass
diff --git a/src/slingshot/player.py b/src/slingshot/player.py
index 2558f85..94cb71c 100644
--- a/src/slingshot/player.py
+++ b/src/slingshot/player.py
@@ -192,7 +192,7 @@ def draw_status(self, screen):
def update_explosion(self):
self.e = self.e + 1
- s = self.e * (6 - self.e) * 100 / 9
+ s = self.e * (6 - self.e) * 100 // 9
if s >= 0:
self.image = pygame.transform.scale(self.exp, (s,s))
pos = self.rect.center
@@ -200,7 +200,7 @@ def update_explosion(self):
self.rect.center = pos
def draw_line(self, screen):
- ''' Draws the aiming line out of the ship's gun. '''
+ ''' Draws the aiming line out of the ship's gun. '''
(sx,sy) = self.get_launchpoint()
pygame.draw.aaline(screen, self.color, (sx,sy), (sx + self.power * math.sin(math.radians(self.angle)), sy - self.power * math.cos(math.radians(self.angle))))
@@ -218,10 +218,10 @@ def draw(self, screen):
# if img2 == 7:
# f = f - 8.0
- print img1
- print img2
- print f
+ print()
+ print(img1)
+ print(img2)
+ print(f)
rect1 = pygame.Rect(img1 * 40, 0, 40, 33)
rect2 = pygame.Rect(img2 * 40, 0, 40, 33)
diff --git a/src/slingshot/settings.py b/src/slingshot/settings.py
index 799fa7b..4f3bd3e 100644
--- a/src/slingshot/settings.py
+++ b/src/slingshot/settings.py
@@ -26,7 +26,7 @@
class Settings:
- VERSION = '0.9'
+ VERSION = '0.9'
g = 120 # gravity
MAXPOWER = 350
@@ -52,7 +52,7 @@ class Settings:
MAX_FLIGHT = 750
MAX_PLANETS = 4
- MAX_BLACKHOLES = 0
+ MAX_BLACKHOLES = 0
HITSCORE = 1500
SELFHIT = 2000
@@ -71,6 +71,6 @@ class Settings:
MAX_ROUNDS = 0
- DATA_PATH = os.path.join(os.path.dirname(__file__), 'data/')
+ DATA_PATH = os.path.join(os.path.dirname(__file__), 'data/')
- FULLSCREEN = False
+ FULLSCREEN = False
368c368
< nn = n / 2
---
> nn = n // 2
371c371
< for i in xrange(nn):
---
> for i in range(nn):
380c380
< for i in xrange(n):
---
> for i in range(n):
386c386
< for i in xrange(n):
---
> for i in range(n):
433c433
< missilesprite = pygame.transform.scale(missilesprite, (missilesprite.get_size()[0] / 3, missilesprite.get_size()[1] / 3))
---
> missilesprite = pygame.transform.scale(missilesprite, (missilesprite.get_size()[0] // 3, missilesprite.get_size()[1] // 3))
717c717
< for i in xrange(1, 3):
---
> for i in range(1, 3):
962c962
< f = file(path, 'wt')
---
> f = open(path, 'wt')
--- a/src/bin/slingshot~ 2020-08-10 08:14:09.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:31:30.115104231 -0500
@@ -365,10 +365,10 @@
def create_particlesystem(self, pos, n, size):
if Settings.PARTICLES:
if Settings.BOUNCE:
- nn = n / 2
+ nn = n // 2
else:
nn = n
- for i in xrange(nn):
+ for i in range(nn):
self.particlesystem.add(Particle(pos, size))
def create_planets(self, planetlist=None):
@@ -377,13 +377,13 @@
if planetlist == None:
if Settings.MAX_BLACKHOLES > 0:
n = randint(1, Settings.MAX_BLACKHOLES)
- for i in xrange(n):
+ for i in range(n):
result.add(Blackhole(result, self.background))
else:
# Only have planets if we don't have any
# blackholes.
n = randint(2, Settings.MAX_PLANETS)
- for i in xrange(n):
+ for i in range(n):
result.add(Planet(result, self.background))
else:
for p in planetlist:
@@ -430,7 +430,7 @@
zoom_screen.blit(normal_screen, (200,150))
missilesprite = self.missile.get_image()
- missilesprite = pygame.transform.scale(missilesprite, (missilesprite.get_size()[0] / 3, missilesprite.get_size()[1] / 3))
+ missilesprite = pygame.transform.scale(missilesprite, (missilesprite.get_size()[0] // 3, missilesprite.get_size()[1] // 3))
pos = self.missile.get_pos()
pos = (200 + pos[0] / 4 - missilesprite.get_width() / 2, 150 + pos[1] / 4- missilesprite.get_height() / 2)
zoom_screen.blit(missilesprite, pos)
@@ -714,7 +714,7 @@
offset1 = 0
power_penalty = self.missile.get_score()
- for i in xrange(1, 3):
+ for i in range(1, 3):
if self.players[i].shot:
if self.player == 3 - i:
message = "Player %d killed self" %(i)
@@ -959,7 +959,7 @@
if not os.path.exists(path):
os.mkdir(path)
path += "/settings"
- f = file(path, 'wt')
+ f = open(path, 'wt')
if self.bounce:
f.write("Bounce: 1\n")
else:
--- a/src/bin/slingshot~ 2020-08-10 08:33:56.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:35:39.607257274 -0500
@@ -64,7 +64,7 @@
Settings.font = pygame.font.Font(get_data_path("FreeSansBold.ttf"), 14)
Settings.menu_font = pygame.font.Font(get_data_path("FreeSansBold.ttf"), Settings.MENU_FONT_SIZE)
Settings.round_font = pygame.font.Font(get_data_path("FreeSansBold.ttf"), 100)
- Settings.fineprint = pygame.font.Font(get_data_path("FreeSansBold.ttf"), 8)
+ Settings.fineprint = pygame.font.Font(get_data_path("FreeSansBold.ttf"), 8)
def __init__(self):
pygame.display.init()
--- a/src/bin/slingshot~ 2020-08-10 08:36:01.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:37:04.624968629 -0500
@@ -110,8 +110,8 @@
self.load_settings()
- if self.fullscreen:
- self.use_fullscreen()
+ if self.fullscreen:
+ self.use_fullscreen()
#self.fixed_power = Settings.FIXED_POWER
#self.bounce = Settings.BOUNCE
--- a/src/bin/slingshot~ 2020-08-10 08:37:22.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:38:20.748710220 -0500
@@ -170,7 +170,7 @@
self.mode_menu = Menu("Game options")
self.mode_menu.add("Back")
self.mode_menu.add("Max number of planets")
- self.mode_menu.add("Max number of black holes")
+ self.mode_menu.add("Max number of black holes")
self.mode_menu.add("Number of rounds")
self.mode_menu.add("Shot timeout")
--- a/src/bin/slingshot~ 2020-08-10 08:38:38.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:39:30.527473348 -0500
@@ -178,7 +178,7 @@
self.graphics_menu = Menu("Graphics")
self.graphics_menu.add("Particles")
- self.graphics_menu.add("Full Screen")
+ self.graphics_menu.add("Full Screen")
self.planet_menu = Numeric("Maximum number of planets", self.max_planets, 1, 8, 2)
--- a/src/bin/slingshot~ 2020-08-10 08:41:19.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:41:50.689997528 -0500
@@ -182,7 +182,7 @@
self.planet_menu = Numeric("Maximum number of planets", self.max_planets, 1, 8, 2)
- self.blackholes_menu = Numeric("Maximum number of black holes", self.max_blackholes, 1, 3, 0)
+ self.blackholes_menu = Numeric("Maximum number of black holes", self.max_blackholes, 1, 3, 0)
self.particles_menu = Menu("Particle")
self.particles_menu.add("Back")
--- a/src/bin/slingshot~ 2020-08-10 08:42:06.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:42:25.548879190 -0500
@@ -189,7 +189,7 @@
self.particles_menu.add("On")
self.particles_menu.add("Off")
- self.fullscreen_menu = Menu("Full Screen")
+ self.fullscreen_menu = Menu("Full Screen")
self.fullscreen_menu.add("Back")
self.fullscreen_menu.add("On")
self.fullscreen_menu.add("Off")
--- a/src/bin/slingshot~ 2020-08-10 08:42:42.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:44:03.673508667 -0500
@@ -190,9 +190,9 @@
self.particles_menu.add("Off")
self.fullscreen_menu = Menu("Full Screen")
- self.fullscreen_menu.add("Back")
- self.fullscreen_menu.add("On")
- self.fullscreen_menu.add("Off")
+ self.fullscreen_menu.add("Back")
+ self.fullscreen_menu.add("On")
+ self.fullscreen_menu.add("Off")
self.rounds_menu = Numeric("Number of rounds", self.max_rounds, 1, 100, 0, "Infinite")
--- a/src/bin/slingshot~ 2020-08-10 08:44:21.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:44:56.666305179 -0500
@@ -236,8 +236,8 @@
result = True
if Settings.RANDOM != self.random:
result = True
- if Settings.FULLSCREEN != self.fullscreen:
- result = True
+ if Settings.FULLSCREEN != self.fullscreen:
+ result = True
return result
--- a/src/bin/slingshot~ 2020-08-10 08:45:10.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:46:12.099015524 -0500
@@ -249,7 +249,7 @@
Settings.MAX_ROUNDS = self.max_rounds
Settings.RANDOM = self.random
Settings.MAX_FLIGHT = self.timeout
- Settings.MAX_BLACKHOLES = self.max_blackholes
+ Settings.MAX_BLACKHOLES = self.max_blackholes
# is there an old network game but the new is none
if self.net_play() and net_client == False and net_host == False:
--- a/src/bin/slingshot~ 2020-08-10 08:46:30.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:46:50.806866889 -0500
@@ -328,7 +328,7 @@
self.menu = None
elif self.menu == self.particles_menu:
self.menu = self.graphics_menu
- elif self.menu == self.fullscreen_menu:
+ elif self.menu == self.fullscreen_menu:
self.menu = self.graphics_menu
elif self.menu == self.rounds_menu:
self.menu = self.mode_menu
--- a/src/bin/slingshot~ 2020-08-10 08:47:10.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:49:27.772252862 -0500
@@ -334,8 +334,8 @@
self.menu = self.mode_menu
elif self.menu == self.planet_menu:
self.menu = self.mode_menu
- elif self.menu == self.blackholes_menu:
- self.menu = self.mode_menu
+ elif self.menu == self.blackholes_menu:
+ self.menu = self.mode_menu
elif self.menu == self.mode_menu:
self.menu = self.settings_menu
elif self.menu == self.style_menu:
--- a/src/bin/slingshot~ 2020-08-10 08:49:45.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:50:37.482979902 -0500
@@ -572,10 +572,10 @@
if c >= 0:
self.max_planets = c
self.toggle_menu()
- if self.menu == self.blackholes_menu:
- if c >= 0:
- self.max_blackholes = c
- self.toggle_menu()
+ if self.menu == self.blackholes_menu:
+ if c >= 0:
+ self.max_blackholes = c
+ self.toggle_menu()
if self.menu == self.rounds_menu:
if c >= 0:
self.max_rounds = c
--- a/src/bin/slingshot~ 2020-08-10 08:50:53.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:52:50.516421472 -0500
@@ -584,23 +584,23 @@
if c >= 0:
self.timeout = c
self.toggle_menu()
- if self.menu == self.particles_menu:
- if c == "On":
- Settings.PARTICLES = True
- self.toggle_menu()
- if c == "Off":
- Settings.PARTICLES = False
- self.toggle_menu()
- if self.menu == self.fullscreen_menu:
- if c == "On":
- self.fullscreen = True
- self.use_fullscreen()
- self.toggle_menu()
- if c == "Off":
- self.fullscreen = False
- self.use_window()
- self.toggle_menu()
- if c == "Quit":
+ if self.menu == self.particles_menu:
+ if c == "On":
+ Settings.PARTICLES = True
+ self.toggle_menu()
+ if c == "Off":
+ Settings.PARTICLES = False
+ self.toggle_menu()
+ if self.menu == self.fullscreen_menu:
+ if c == "On":
+ self.fullscreen = True
+ self.use_fullscreen()
+ self.toggle_menu()
+ if c == "Off":
+ self.fullscreen = False
+ self.use_window()
+ self.toggle_menu()
+ if c == "Quit":
self.q = True
elif c == "Back":
self.toggle_menu()
--- a/src/bin/slingshot~ 2020-08-10 08:53:08.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:54:11.157073433 -0500
@@ -661,12 +661,12 @@
self.invisible = not self.invisible
elif c == "Max number of planets":
self.menu = self.planet_menu
- elif c == "Max number of black holes":
- self.menu = self.blackholes_menu
+ elif c == "Max number of black holes":
+ self.menu = self.blackholes_menu
elif c == "Particles":
self.menu = self.particles_menu
- elif c == "Full Screen":
- self.menu = self.fullscreen_menu
+ elif c == "Full Screen":
+ self.menu = self.fullscreen_menu
def update(self):
self.update_particles()
--- a/src/bin/slingshot~ 2020-08-10 08:54:26.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:55:22.481765613 -0500
@@ -674,7 +674,7 @@
self.firing = self.missile.update(self.planetsprites, self.players)
if self.missile.flight < 0 and not self.missile.visible():
self.firing = 0
- if self.firing <= 0:
+ if self.firing <= 0:
# Collision between missile and planet (0) or
# a black hole (-1).
#
@@ -682,10 +682,10 @@
# hole, the missile got sucked up.
if self.firing == 0 and self.missile.visible():
self.create_particlesystem(self.missile.get_impact_pos(), Settings.n_PARTICLES_10, 10)
- self.end_shot()
+ self.end_shot()
- if self.net_play() and not self.active_net_player():
- thread.start_new_thread(self.thread_job,())
+ if self.net_play() and not self.active_net_player():
+ thread.start_new_thread(self.thread_job,())
if not self.menu == None:
self.menu_action()
--- a/src/bin/slingshot~ 2020-08-10 08:58:49.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 08:59:19.713741761 -0500
@@ -680,7 +680,7 @@
#
# Don't create any particles when we hit a black
# hole, the missile got sucked up.
- if self.firing == 0 and self.missile.visible():
+ if self.firing == 0 and self.missile.visible():
self.create_particlesystem(self.missile.get_impact_pos(), Settings.n_PARTICLES_10, 10)
self.end_shot()
--- a/src/bin/slingshot~ 2020-08-10 08:59:41.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 09:00:23.518466391 -0500
@@ -913,10 +913,10 @@
self.invisible = Settings.INVISIBLE
self.random = Settings.RANDOM
self.max_planets = Settings.MAX_PLANETS
- self.max_blackholes = Settings.MAX_BLACKHOLES
+ self.max_blackholes = Settings.MAX_BLACKHOLES
self.timeout = Settings.MAX_FLIGHT
self.max_rounds = Settings.MAX_ROUNDS
- self.fullscreen = Settings.FULLSCREEN
+ self.fullscreen = Settings.FULLSCREEN
path = os.path.expanduser("~") + "/.slingshot/settings"
--- a/src/bin/slingshot~ 2020-08-10 09:00:36.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 09:01:23.932205656 -0500
@@ -934,9 +934,9 @@
elif tokens[0] == "Particles:":
if tokens[1] == "1":
Settings.PARTICLES = True
- elif tokens[0] == "Fullscreen:":
- if tokens[1] == "1":
- self.fullscreen = True
+ elif tokens[0] == "Fullscreen:":
+ if tokens[1] == "1":
+ self.fullscreen = True
elif tokens[0] == "Random:":
if tokens[1] == "1":
self.random = True
--- a/src/bin/slingshot~ 2020-08-10 09:01:45.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 09:02:39.813878163 -0500
@@ -943,8 +943,8 @@
elif tokens[0] == "Invisible:":
if tokens[1] == "1":
self.invisible = True
- elif tokens[0] == "Max_Blackholes:":
- self.max_blackholes = int(tokens[1])
+ elif tokens[0] == "Max_Blackholes:":
+ self.max_blackholes = int(tokens[1])
elif tokens[0] == "Max_Planets:":
self.max_planets = int(tokens[1])
elif tokens[0] == "Timeout:":
--- a/src/bin/slingshot~ 2020-08-10 09:02:51.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 09:04:25.463422199 -0500
@@ -980,10 +980,10 @@
f.write("Particles: 1\n")
else:
f.write("Particles: 0\n")
- if self.fullscreen:
- f.write("Fullscreen: 1\n")
- else:
- f.write("Fullscreen: 0\n")
+ if self.fullscreen:
+ f.write("Fullscreen: 1\n")
+ else:
+ f.write("Fullscreen: 0\n")
f.write("Max_Planets: %d\n" %(self.max_planets))
f.write("Max_Blackholes: %d\n" %(self.max_blackholes))
f.write("Timeout: %d\n" %(self.timeout))
--- a/src/bin/slingshot~ 2020-08-10 09:04:42.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 09:05:22.067177907 -0500
@@ -985,7 +985,7 @@
else:
f.write("Fullscreen: 0\n")
f.write("Max_Planets: %d\n" %(self.max_planets))
- f.write("Max_Blackholes: %d\n" %(self.max_blackholes))
+ f.write("Max_Blackholes: %d\n" %(self.max_blackholes))
f.write("Timeout: %d\n" %(self.timeout))
f.write("Rounds: %d\n" %(self.max_rounds))
f.close()
--- a/src/bin/slingshot~ 2020-08-10 09:05:36.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 09:06:50.872794633 -0500
@@ -1087,7 +1087,7 @@
self.max_planets = packet[4]
self.timeout = packet[5]
self.max_rounds = packet[6]
- self.max_blackholes = packet[7]
+ self.max_blackholes = packet[7]
self.menu = None
self.save_settings()
--- a/src/bin/slingshot~ 2020-08-10 09:07:04.000000000 -0500
+++ b/src/bin/slingshot 2020-08-10 09:10:32.336838808 -0500
@@ -1115,11 +1115,11 @@
self.net.close()
return ret
- def use_fullscreen(self):
- pygame.display.set_mode((0, 0), pygame.FULLSCREEN | pygame.NOFRAME)
+ def use_fullscreen(self):
+ pygame.display.set_mode((0, 0), pygame.FULLSCREEN | pygame.NOFRAME)
- def use_window(self):
- pygame.display.set_mode((800, 600))
+ def use_window(self):
+ pygame.display.set_mode((800, 600))
def main():