Smaller player
This commit is contained in:
parent
5dfa2a06af
commit
a6e7e0a436
BIN
gamedata/assets/player/0.png
Normal file
BIN
gamedata/assets/player/0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,9 @@ class Player(Movable):
|
|||||||
spawnpoint = game.lib.choice(self.tileset.spawns)
|
spawnpoint = game.lib.choice(self.tileset.spawns)
|
||||||
self.rect.move_ip(spawnpoint.center)
|
self.rect.move_ip(spawnpoint.center)
|
||||||
|
|
||||||
self.sprite = game.sprite_lib["icon.png"]
|
self.sprite = game.sprite_lib["player/0.png"]
|
||||||
|
self.rect[2] = self.sprite.get_width()
|
||||||
|
self.rect[3] = self.sprite.get_height()
|
||||||
|
|
||||||
self.speed = 200
|
self.speed = 200
|
||||||
|
|
||||||
@ -33,13 +35,14 @@ class Player(Movable):
|
|||||||
|
|
||||||
self.attackstate = None
|
self.attackstate = None
|
||||||
|
|
||||||
self.stepsize = 20
|
|
||||||
|
|
||||||
self.gravity = 15
|
self.gravity = 15
|
||||||
self.maxgravity = 30
|
self.maxgravity = 30
|
||||||
self.jump = -5
|
self.jump = -5
|
||||||
self.verspd = self.maxgravity
|
self.verspd = self.maxgravity
|
||||||
|
|
||||||
|
self.candash = False
|
||||||
|
self.canfastfall = False
|
||||||
|
|
||||||
self.gravityway = 1
|
self.gravityway = 1
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
@ -60,6 +63,8 @@ class Player(Movable):
|
|||||||
self.onceilling = False
|
self.onceilling = False
|
||||||
if self.checkcollisions(0,self.gravityway):
|
if self.checkcollisions(0,self.gravityway):
|
||||||
self.onground = True
|
self.onground = True
|
||||||
|
self.candash = True
|
||||||
|
self.canfastfall = True
|
||||||
if self.gravityway > 0:
|
if self.gravityway > 0:
|
||||||
self.verspd=min(0,self.verspd)
|
self.verspd=min(0,self.verspd)
|
||||||
else:
|
else:
|
||||||
@ -86,12 +91,7 @@ class Player(Movable):
|
|||||||
if 0<keys["up"]["timer"]<=3:
|
if 0<keys["up"]["timer"]<=3:
|
||||||
self.verspd= self.jump*self.gravityway
|
self.verspd= self.jump*self.gravityway
|
||||||
self.jumped = True
|
self.jumped = True
|
||||||
if self.verspd==0:
|
super().step()
|
||||||
self.move(0,-self.stepsize*self.gravityway)
|
|
||||||
super().step()
|
|
||||||
self.move(0,self.stepsize*self.gravityway)
|
|
||||||
else:
|
|
||||||
super().step()
|
|
||||||
|
|
||||||
# Reducing the knockback
|
# Reducing the knockback
|
||||||
if self.horkb>0:
|
if self.horkb>0:
|
||||||
@ -112,8 +112,9 @@ class Player(Movable):
|
|||||||
self.rect.bottom = semi.top+1
|
self.rect.bottom = semi.top+1
|
||||||
falled = True
|
falled = True
|
||||||
if not falled: # Check for fastfall
|
if not falled: # Check for fastfall
|
||||||
if abs(self.verspd) <= self.fastfallmargin and not self.onground:
|
if self.canfastfall and abs(self.verspd) <= self.fastfallmargin and not self.onground:
|
||||||
self.verspd = self.maxgravity/5*self.gravityway
|
self.verspd = self.maxgravity/5*self.gravityway
|
||||||
|
self.canfastfall = False
|
||||||
|
|
||||||
else: # If I'm in hitpose
|
else: # If I'm in hitpose
|
||||||
if self.hitposetimer.tick(self.game.dt):
|
if self.hitposetimer.tick(self.game.dt):
|
||||||
|
@ -28,7 +28,7 @@ def fight(game):
|
|||||||
game.gameloop.summon(tileset)
|
game.gameloop.summon(tileset)
|
||||||
box = Hitbox(100,80,game)
|
box = Hitbox(100,80,game)
|
||||||
game.gameloop.summon(box)
|
game.gameloop.summon(box)
|
||||||
water = Water(200,game)
|
water = Water(250,game)
|
||||||
game.gameloop.summon(water)
|
game.gameloop.summon(water)
|
||||||
p1 = Player(game)
|
p1 = Player(game)
|
||||||
game.gameloop.summon(p1)
|
game.gameloop.summon(p1)
|
||||||
|
Loading…
Reference in New Issue
Block a user