-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from letsbuilda/rotation
Add rotation
- Loading branch information
Showing
3 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
"""Player Sprite""" | ||
|
||
import math | ||
|
||
import arcade | ||
|
||
from ..constants import SPRITE_SCALING_PLAYER | ||
from ..constants import ASSETS_DIR, SPRITE_SCALING_PLAYER | ||
|
||
|
||
class PlayerSprite(arcade.Sprite): | ||
"""Player Sprite""" | ||
|
||
def __init__(self): | ||
def __init__(self, *args, **kwargs): | ||
"""Init""" | ||
super().__init__() | ||
super().__init__(*args, **kwargs) | ||
|
||
self.scale = SPRITE_SCALING_PLAYER | ||
|
||
def point_to(self, x, y): | ||
"""Point to a location""" | ||
|
||
offset = 210 # cannon is off | ||
angle = math.degrees(math.atan2(y - self.center_y, x - self.center_x)) | ||
self.angle = angle + offset | ||
|
||
def update(self): | ||
"""Update""" |