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 22, 2024
1 parent 5b6c73f commit 6c9ae2c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions star-dash/star-dash.xcodeproj/project.pbxproj
Expand Up @@ -85,6 +85,8 @@
E64361152BA4C2CD003850FD /* GameBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = E643610F2BA4C2CC003850FD /* GameBridge.swift */; };
E69EE9322BAC6CBB00033AB5 /* GameInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69EE9312BAC6CBB00033AB5 /* GameInfo.swift */; };
E69EE9342BAC6CC300033AB5 /* OverlayInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69EE9332BAC6CC300033AB5 /* OverlayInfo.swift */; };
E69FDDE02BAD3DAD0089D5F3 /* PointsComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69FDDDF2BAD3DAD0089D5F3 /* PointsComponent.swift */; };
E69FDDE22BAD3DC40089D5F3 /* EntityConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = E69FDDE12BAD3DC40089D5F3 /* EntityConstants.swift */; };
E6A011172BA5F4AD006904D9 /* EntitySyncInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A011162BA5F4AD006904D9 /* EntitySyncInterface.swift */; };
E6A745162BA057040080C1BE /* MTKRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A745112BA057040080C1BE /* MTKRenderer.swift */; };
E6A745172BA057040080C1BE /* ControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A745122BA057040080C1BE /* ControlView.swift */; };
Expand Down Expand Up @@ -212,6 +214,8 @@
E643610F2BA4C2CC003850FD /* GameBridge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameBridge.swift; sourceTree = "<group>"; };
E69EE9312BAC6CBB00033AB5 /* GameInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameInfo.swift; sourceTree = "<group>"; };
E69EE9332BAC6CC300033AB5 /* OverlayInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OverlayInfo.swift; sourceTree = "<group>"; };
E69FDDDF2BAD3DAD0089D5F3 /* PointsComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PointsComponent.swift; sourceTree = "<group>"; };
E69FDDE12BAD3DC40089D5F3 /* EntityConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EntityConstants.swift; sourceTree = "<group>"; };
E6A011162BA5F4AD006904D9 /* EntitySyncInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EntitySyncInterface.swift; sourceTree = "<group>"; };
E6A745112BA057040080C1BE /* MTKRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MTKRenderer.swift; sourceTree = "<group>"; };
E6A745122BA057040080C1BE /* ControlView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -464,6 +468,7 @@
4E630F282B9F7EC20008F887 /* Components */ = {
isa = PBXGroup;
children = (
E69FDDDF2BAD3DAD0089D5F3 /* PointsComponent.swift */,
E6B34A462BAA03AF0009A60B /* PlayerComponent.swift */,
4E630F292B9F7EF60008F887 /* PositionComponent.swift */,
14970F4F2BA814D500CC1E8A /* ScoreComponent.swift */,
Expand All @@ -487,6 +492,7 @@
4E86605D2BA095CC0035530D /* Constants */ = {
isa = PBXGroup;
children = (
E69FDDE12BAD3DC40089D5F3 /* EntityConstants.swift */,
4E8660652BA097D40035530D /* PhysicsConstants.swift */,
14970F552BA8177B00CC1E8A /* GameConstants.swift */,
);
Expand Down Expand Up @@ -765,6 +771,7 @@
4604BBD92BA81C940078B84C /* InventorySystem.swift in Sources */,
14E247952BA2CB480071FFC0 /* EventManager.swift in Sources */,
4E630EF82B9F7E070008F887 /* SceneDelegate.swift in Sources */,
E69FDDE02BAD3DAD0089D5F3 /* PointsComponent.swift in Sources */,
14970F542BA8163300CC1E8A /* ScoreSystem.swift in Sources */,
E64361112BA4C2CD003850FD /* SyncModule.swift in Sources */,
E6A7451B2BA0C1890080C1BE /* PlayerView.swift in Sources */,
Expand All @@ -786,6 +793,7 @@
E6A7451D2BA0CAD90080C1BE /* JoystickView.swift in Sources */,
E6B550A12BA15E9C00DC7396 /* OverlayView.swift in Sources */,
46D418262BA5D6500091A38B /* Wall+Collidable.swift in Sources */,
E69FDDE22BAD3DC40089D5F3 /* EntityConstants.swift in Sources */,
4E630F342B9F8FC00008F887 /* Player.swift in Sources */,
4E630F372B9F91DE0008F887 /* PlayerSprite.swift in Sources */,
14970F502BA814D500CC1E8A /* ScoreComponent.swift in Sources */,
Expand Down
8 changes: 5 additions & 3 deletions star-dash/star-dash/Constants/EntityConstants.swift
@@ -1,7 +1,9 @@
import CoreGraphics

struct EntityConstants {
struct CoinCollectible {
let points = 10
let sprite = "Coin"
let size = CGSize(width: 50, height: 50)
static let points = 10
static let sprite = "Coin"
static let size = CGSize(width: 50, height: 50)
}
}
Expand Up @@ -21,7 +21,7 @@ class PickupCollectibleEvent: Event {

func execute(on target: EventModifiable) {
guard let scoreSystem = target.system(ofType: ScoreSystem.self),
let pointsComponent = target.component(ofType: PointsComponent.self, ofEntity: entityId) else {
let pointsComponent = target.component(ofType: PointsComponent.self, ofEntity: collectibleEntityId) else {
return
}
scoreSystem.applyScoreChange(to: entityId, scoreChange: pointsComponent.points)
Expand Down

0 comments on commit 6c9ae2c

Please sign in to comment.