Browse Source

Fix creep movement when colliding with a wall

master
Trevor Slocum 2 months ago
parent
commit
56fd9835ba
  1. 12
      README.md
  2. 9
      creep.go

12
README.md

@ -3,9 +3,7 @@
Twin-stick shooter
**Note:** This game is in pre-alpha state. Here be dragons.
This game was created during the [2021 Vampire Themed Game Jam](https://itch.io/jam/vampire-themed-game-jam-october-2021).
This game was created for the [2021 Vampire Themed Game Jam](https://itch.io/jam/vampire-themed-game-jam-october-2021).
## Play
@ -13,10 +11,16 @@ Playing with a gamepad is recommended.
### Browser
[**Click here to play Carotid Artillery**](https://rocketnine.itch.io/carotid-artillery)
[**Play in your browser**](https://rocketnine.itch.io/carotid-artillery)
### Desktop
#### Download
[**Download for Windows and Linux**](https://rocketnine.itch.io/carotid-artillery#download)
#### Compile
**Note:** You will need to install the dependencies listed for [your platform](https://github.com/hajimehoshi/ebiten/blob/main/README.md#platforms).
Run the following command to build a `carotidartillery` executable:

9
creep.go

@ -148,11 +148,16 @@ func (c *gameCreep) Update() {
}
x, y := c.x+c.moveX, c.y+c.moveY
if !c.level.isFloor(x, y, false) {
if c.level.isFloor(x, y, false) {
c.x, c.y = x, y
} else if c.level.isFloor(x, c.y, false) {
c.x = x
} else if c.level.isFloor(c.x, y, false) {
c.y = y
} else {
c.nextAction = 0
return
}
c.x, c.y = x, y
if repelled {
dx, dy := deltaXY(c.x, c.y, c.player.x, c.player.y)

Loading…
Cancel
Save