Commits

Bastien Léonard  committed 70b736a

Updated to make it work with the latest pySFML version

  • Participants
  • Parent commits 68d365c

Comments (0)

Files changed (7)

 
 import random
 
-import sf
+import sfml as sf
 
 from entity import Entity
 import utils
 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-import sf
+import sfml as sf
 
 import config
 
 
     def draw(self, window):
         if config.draw_hitboxes and hasattr(self, 'hitbox'):
-            window.draw(sf.Shape.rectangle(
-                self.hitbox.left, self.hitbox.top,
-                self.hitbox.width, self.hitbox.height,
-                sf.Color.BLACK, 1.0, sf.Color.RED))
+            rect = sf.RectangleShape((self.hitbox.width, self.hitbox.height))
+            rect.position = (self.hitbox.left, self.hitbox.top)
+            rect.fill_color = sf.Color.RED
+            window.draw(rect)
 
 import os.path
 
-import sf
+import sfml as sf
 
 import boosts
 import config

File obstacles.py

 import math
 import random
 
-import sf
+import sfml as sf
 
 from entity import Entity
 import pubsub
 import math
 import sys
 
-import sf
+import sfml as sf
 
 from entity import Entity
 import utils
                 min_diff = diff
                 closest_slope = s
 
-        self.sprite.texture_rect = slopes[closest_slope]
-
+        self.sprite.set_texture_rect(slopes[closest_slope])
         alpha = math.atan(slope)
         to_move_y = distance * math.sin(alpha)
         to_move_x = math.sqrt(distance * distance - to_move_y * to_move_y)
 
 import random
 
-import sf
+import sfml as sf
 
 from entity import Entity
 import utils
 
 import os.path
 
-import sf
+import sfml as sf
 
 
 def get_texture(path, cache={}):