diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/character_system.cpp | 6 | ||||
-rw-r--r-- | src/script_system.cpp | 3 | ||||
-rw-r--r-- | src/sprite.h | 1 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/character_system.cpp b/src/character_system.cpp index 6e15eac..99b6929 100644 --- a/src/character_system.cpp +++ b/src/character_system.cpp | |||
@@ -117,7 +117,7 @@ void CharacterSystem::tick(double dt) { | |||
117 | CollisionResult collision = game_.getSystem<TransformSystem>().checkCollision(spriteId, pLoc, sprite.dir); | 117 | CollisionResult collision = game_.getSystem<TransformSystem>().checkCollision(spriteId, pLoc, sprite.dir); |
118 | bool blocked = collision.horiz.blocked || collision.vert.blocked; | 118 | bool blocked = collision.horiz.blocked || collision.vert.blocked; |
119 | 119 | ||
120 | if (collision.horiz.blocked) { | 120 | if (collision.horiz.blocked && !sprite.clipping) { |
121 | pLoc.x() = sprite.loc.x();//(newColPosDR * map.getTileSize() - (collisionBox / 2)).x() - 1; | 121 | pLoc.x() = sprite.loc.x();//(newColPosDR * map.getTileSize() - (collisionBox / 2)).x() - 1; |
122 | } else if (collision.horiz.colliderSprite != -1) { | 122 | } else if (collision.horiz.colliderSprite != -1) { |
123 | Sprite& collider = game_.getSprite(collision.horiz.colliderSprite); | 123 | Sprite& collider = game_.getSprite(collision.horiz.colliderSprite); |
@@ -127,7 +127,7 @@ void CharacterSystem::tick(double dt) { | |||
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | if (collision.vert.blocked) { | 130 | if (collision.vert.blocked && !sprite.clipping) { |
131 | pLoc.y() = sprite.loc.y();//(newColPosDR * map.getTileSize() - (collisionBox / 2)).x() - 1; | 131 | pLoc.y() = sprite.loc.y();//(newColPosDR * map.getTileSize() - (collisionBox / 2)).x() - 1; |
132 | } else if (collision.vert.colliderSprite != -1) { | 132 | } else if (collision.vert.colliderSprite != -1) { |
133 | Sprite& collider = game_.getSprite(collision.vert.colliderSprite); | 133 | Sprite& collider = game_.getSprite(collision.vert.colliderSprite); |
@@ -137,7 +137,7 @@ void CharacterSystem::tick(double dt) { | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | if (blocked && sprite.characterState == CharacterState::Running) { | 140 | if (blocked && sprite.characterState == CharacterState::Running && !sprite.clipping) { |
141 | stopRunning(spriteId); | 141 | stopRunning(spriteId); |
142 | game_.getMixer().playSound("../res/sfx/bump.wav"); | 142 | game_.getMixer().playSound("../res/sfx/bump.wav"); |
143 | } | 143 | } |
diff --git a/src/script_system.cpp b/src/script_system.cpp index 769a872..2e02edf 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
@@ -37,7 +37,8 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
37 | return sprite.frames[sprite.animations[sprite.animationId].frameIndices[sprite.animationFrame]]; | 37 | return sprite.frames[sprite.animations[sprite.animationId].frameIndices[sprite.animationFrame]]; |
38 | }, | 38 | }, |
39 | "persistent", &Sprite::persistent, | 39 | "persistent", &Sprite::persistent, |
40 | "paused", &Sprite::paused); | 40 | "paused", &Sprite::paused, |
41 | "clipping", &Sprite::clipping); | ||
41 | 42 | ||
42 | engine_.new_usertype<MessageSystem>( | 43 | engine_.new_usertype<MessageSystem>( |
43 | "message", | 44 | "message", |
diff --git a/src/sprite.h b/src/sprite.h index 35ca7aa..3d2e9df 100644 --- a/src/sprite.h +++ b/src/sprite.h | |||
@@ -77,6 +77,7 @@ public: | |||
77 | CharacterState characterState = CharacterState::Still; | 77 | CharacterState characterState = CharacterState::Still; |
78 | StepType stepType = StepType::none; | 78 | StepType stepType = StepType::none; |
79 | int runningSfxChannel = -1; | 79 | int runningSfxChannel = -1; |
80 | bool clipping = false; | ||
80 | 81 | ||
81 | // Input | 82 | // Input |
82 | bool controllable = false; | 83 | bool controllable = false; |