Skip to content

Commit

Permalink
fix: Fix syntax issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Junyi00 committed Mar 16, 2024
1 parent f57f202 commit aab969f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ class PositionComponent: Component {
var position: CGPoint
var rotation: CGFloat

init(id: UUID, entityId: UUID, position: CGPoint, rotation: Float) {
init(id: UUID, entityId: UUID, position: CGPoint, rotation: CGFloat) {
self.position = position
self.rotation = rotation
super.init(id: id, entityId: entityId)
}

convenience init(entityId: UUID, position: CGPoint, rotation: Float) {
convenience init(entityId: UUID, position: CGPoint, rotation: CGFloat) {
self.init(id: UUID(), entityId: entityId, position: position, rotation: rotation)
}

func setPosition(position: CGPoint) {
self.position = position
}

func setRotation(rotation: Float) {
func setRotation(rotation: CGFloat) {
self.rotation = rotation
}
}
4 changes: 2 additions & 2 deletions star-dash/star-dash/GameEngine/Systems/PositionSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class PositionSystem: System {
positionComponent.setPosition(position: newPosition)
}

func rotate(entityId: EntityId, to newRotation: Float) {
func rotate(entityId: EntityId, to newRotation: CGFloat) {
guard let positionComponent = getPositionComponent(of: entityId) else {
return
}

positionComponent.setRotation(rotation: newRotation)
}

func sync(entityPositionMap: [EntityId: CGPoint], entityRotationMap: [EntityId: Float]) {
func sync(entityPositionMap: [EntityId: CGPoint], entityRotationMap: [EntityId: CGFloat]) {
for (entityId, newPosition) in entityPositionMap {
move(entityId: entityId, to: newPosition)
}
Expand Down

0 comments on commit aab969f

Please sign in to comment.