Skip to content

Conversation

@leolevd
Copy link
Contributor

@leolevd leolevd commented Oct 25, 2025

Your checklist for this pull request

Leolevd

Author:

LeoLevd

About your game

What is your game about?

This 2P game is about Fire and Water.
You need to get to your opponent's base before your opponent does the same.

There are two obstacles though.

  1. Bots. They love pushing the opponent to the edge.
  2. Glue traps. These smily glue puddles stick you to a place for some time while your opponent conquers your base.

How do you play your game?

P1: WASD to move, get to the base labeled '2'
P2: IJKL to move, get to the base labeled '1'

Code

Check off the items that are true.

  • The game was made using the Sprig editor.
  • The game is placed in the in the /games directory.
  • The code is significantly different from all other games in the Sprig gallery (except for games labeled "demo").
  • The game runs without errors.
  • The name of the file/game contains only alphanumeric characters, -s, or _s.
  • The game name is not the same as the others from gallery
  • The game has metadata at the top of the file in the following format:
    /*
    @title:
    @author:
    @description:
    @tags: []
    @addedOn: 2025-MM-DD
    */
    

Image (If an image is used)

Thanks for your PR!

@whatwareweb
Copy link
Collaborator

Hello, please check our PR checklist here:

https://github.com/hackclub/sprig/blob/main/.github/PULL_REQUEST_TEMPLATE.md

@whatwareweb whatwareweb added the triaged This PR has been triaged - awaiting reviewer label Oct 27, 2025
@leolevd leolevd marked this pull request as draft October 27, 2025 17:56
@leolevd
Copy link
Contributor Author

leolevd commented Oct 27, 2025

Oops, I see.
I will reopen my pull request, thanks.

@leolevd leolevd closed this Oct 27, 2025
@leolevd leolevd reopened this Oct 27, 2025
@leolevd leolevd closed this Oct 27, 2025
@leolevd leolevd reopened this Oct 27, 2025
@leolevd
Copy link
Contributor Author

leolevd commented Oct 27, 2025

Ok, I think I'm done.

@whatwareweb whatwareweb marked this pull request as ready for review October 27, 2025 23:05
@whatwareweb
Copy link
Collaborator

https://github.com/hackclub/sprig/pull/3396/files

Please double check your files at this link, it looks like your changes did not go through for some reason? Whenever the files are updated, it will show up in that link

@leolevd
Copy link
Contributor Author

leolevd commented Oct 28, 2025

Is it? I see clearly my file games/Capture The Base.js
I don't have my image.

@whatwareweb
Copy link
Collaborator

It still looks like you are missing the metadata tags, and also your filename still has spaces. Once you change that we can get started with review!

@leolevd leolevd changed the title Capture The Base Capture_The_Base Nov 3, 2025
@leolevd
Copy link
Contributor Author

leolevd commented Nov 3, 2025

I fixed everything!

@whatwareweb
Copy link
Collaborator

whatwareweb commented Nov 4, 2025

It looks like you are still missing the description, can you copy and paste exactly like this, and then add your tags?

/*
@title:
@author:
@description:
@tags: []
@addedOn: 2025-MM-DD
*/

@leolevd
Copy link
Contributor Author

leolevd commented Nov 7, 2025

I added description now. :)

@whatwareweb
Copy link
Collaborator

OK metadata looks good, a reviewer will take a look at your game soon!

@whatwareweb whatwareweb added the awaiting-review Preliminary metadata check is complete, awaiting. review! label Nov 7, 2025
@whatwareweb whatwareweb self-assigned this Nov 7, 2025
@whatwareweb
Copy link
Collaborator

OK, just played your game and I love the concept, seems like it would be very fun!! however it is pretty simple. Can you add some more unique game mechanics?

@leolevd
Copy link
Contributor Author

leolevd commented Nov 7, 2025

Yeah I could, just don't know what, don't have enough buttons :)

@whatwareweb
Copy link
Collaborator

Maybe add powerups, or shields, maybe new maps, maybe enemies or something? idk use your imagination :)

@leolevd
Copy link
Contributor Author

leolevd commented Nov 10, 2025

Ok. I added:
Bots that help their partner and annoy opponent.
These little smily glue traps that gurantee loosing if stuck.

@leolevd
Copy link
Contributor Author

leolevd commented Nov 10, 2025

Thanks for idea of enemies!)

@leolevd
Copy link
Contributor Author

leolevd commented Nov 10, 2025

Also, I checked out your website, cool, however I wanted to report a bug: If you click home (for some reason) on microsoft edge the canvas doesn't fully load, and half the page is white

Just thought that it would be easier to tell you here)

@leolevd
Copy link
Contributor Author

leolevd commented Nov 11, 2025

WhatWare? Are you there?

@whatwareweb
Copy link
Collaborator

sorry, been a busy week for me and im the only reviewer 😭

@whatwareweb
Copy link
Collaborator

also that bug is very strange, i'll look into it if i ever use windows again lol

Copy link
Collaborator

@whatwareweb whatwareweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok just took a look at the game, love it! again the artwork is really nice

@whatwareweb whatwareweb added this pull request to the merge queue Nov 11, 2025
@whatwareweb
Copy link
Collaborator

Thanks for your submission!

If you're a teen, you can get your Sprig here! sprig-order.hackclub.dev

Hack Clubbers would love to see this! Just post a link and 1-2 sentences talking about your game to our #ship channel

Merged via the queue into hackclub:main with commit af7e813 Nov 11, 2025
@leolevd
Copy link
Contributor Author

leolevd commented Nov 11, 2025

Cool!
I've just made a new mechanic, could you also add it?
Like bots protecting their bases.

@title: Capture The Base
@author: LeoLevd
@description: A 2-player capture the flag style game for sprig. Controls: Player1: WASD to move, to win move to P2 base. Player2: IJKL to move, reach P1 base to win.
@tags: [2P, BaseCapture, 2-Player]
@addedOn: 2025-00-00
*/

const player = "1"
const player2 = "2"
const p1base = "f"
const p2base = "w"
const back = "b"
const botF = "F"
const botW = "W"
const glueTrap = "g"

// CONFIG (Experimental)
const botMoveFreq = 700


setLegend(
  [botF, bitmap`
.D..H.H..H.H..D.
DDDH.H.HH.H.HDDD
.D..H.H..H.H..D.
0D000000000000D0
0333333333333330
0332333333332330
0329233333329230
0329223333229230
0329992332999230
0332292332922330
0333323333233330
0333333333333330
0333333333333330
0333333333333330
0333333333333330
0000000000000000`], [botW, bitmap`
.3..6.6..6.6..3.
3336.6.66.6.6333
.3..6.6..6.6..3.
0300000000000030
0555555555555550
0552555555552550
0527255555527250
0527225555227250
0527772552777250
0552272552722550
0555525555255550
0555555555555550
0555555555555550
0555555555555550
0555555555555550
0000000000000000`], [ player, bitmap`
................
..33..33..3.....
.333..393.3.....
.393..393.33....
.393.33933333...
3393339999993...
399999999999333.
399902999029993.
999900999009993.
999999999999999.
999999999999999.
999999999999999.
.66999999999996.
.66666666666666.
...6666666666...
................`], [player2, bitmap`
.......55.......
......5775......
.....557755.....
....55777755....
...5577777755...
..557777777755..
..577777777775..
..577027702775..
.55770077007755.
.57777777777775.
5777777777777775
5777777777777775
5777777777777775
5577777777777755
.55555555555555.
...5555555555...`], [p1base, bitmap`
9696969696969696
6969696969696969
9699999999999996
6999999299999969
9699992329999996
6999923329999969
9699232329999996
6999922329999969
9699992329999996
6999992329999969
9699992329999996
6999999299999969
9699999999999996
6999999999999969
9696969696969696
6969696969696969`], [p2base, bitmap`
7777777777777777
7775555555555777
7755555555555577
7575550000555757
7755507777055577
7575070007055757
7755070007055577
7575555070555757
7755550705555577
7575507000555757
7755077777055577
7575500000555757
7755555555555577
7755555555555577
7775555555555777
7777777777777777`], [back, bitmap`
4444444444444444
4442224444444424
4442444444444444
2244444224444444
4444444424444444
4244444444442444
4444444444444444
4444422444244444
4444442444444444
4444444444444444
4244444444442444
4444444424444444
2244424224244444
4442444444444444
4442224444244424
4444424444244444`], [glueTrap, bitmap`
...2222222222...
...22222222222..
..2221112222222.
..22211111122222
2222111111111222
2222111111111122
2222111H11H11122
2222111111111122
222111HHHHHH1122
222111HHHHHH1222
2221111HHHH11222
.221111111111222
.222111111122222
.22222222222222.
...22222222222..
...22222222.....`]
)

setSolids([player, player2, botF, botW])

let level = 0
let scoreW = 0
let scoreF = 0
let finished = 0
const levels = [
  map`
............
..........W.
..1........w
f....g...2..
.F..........
............`
]

function touching(sprite1, sprite2) {
  return sprite1.x === sprite2.x && sprite1.y === sprite2.y;
}


setMap(levels[level])
setBackground(back)

setPushables({
  [player]: [player2],
  [player2]: [player],
  [botF]: [player2],
  [botW]: [player]
})

function botMove() {
  if (finished) return;

  
  if (Math.abs(getFirst(player2).x - getFirst(p1base).x) <= 2 && Math.abs(getFirst(player2).y - getFirst(p1base).y) <= 2) {
    getFirst(botF).x = getFirst(p1base).x
    getFirst(botF).y = getFirst(p1base).y
  }
  if (Math.abs(getFirst(player).x - getFirst(p2base).x) <= 2 && Math.abs(getFirst(player).y - getFirst(p2base).y) <= 2) {
    getFirst(botW).x = getFirst(p2base).x
    getFirst(botW).y = getFirst(p2base).y
  }
  if (getFirst(botF).y != getFirst(player2).y) {
    if (getFirst(botF).y > getFirst(player2).y) {
      getFirst(botF).y -= 1
    } else {
      getFirst(botF).y += 1
    }
  }
  if (getFirst(botF).x != getFirst(player2).x) {
    if (getFirst(botF).x > getFirst(player2).x) {
      getFirst(botF).x -= 1
    } else {
      getFirst(botF).x += 1
    }
  }


  if (getFirst(botW).y != getFirst(player).y) {
    if (getFirst(botW).y > getFirst(player).y) {
      getFirst(botW).y -= 1
    } else {
      getFirst(botW).y += 1
    }
  }
  if (getFirst(botW).x != getFirst(player).x) {
    if (getFirst(botW).x > getFirst(player).x) {
      getFirst(botW).x -= 1
    } else {
      getFirst(botW).x += 1
    }
  }
}

function move(p, d) {
  if (touchingGlueTrap(p)) return
  if (finished) return;
  if (p == "1") {
    
    switch (d) {
      case "l":
        getFirst(player).x -= 1
        break;
      case "r":
        getFirst(player).x += 1
        break;
      case "u":
        getFirst(player).y -= 1
        break;
      case "d":
        getFirst(player).y += 1
    }
  } else if (p == "2") {
    switch (d) {
      case "l":
        getFirst(player2).x -= 1
        break;
      case "r":
        getFirst(player2).x += 1
        break;
      case "u":
        getFirst(player2).y -= 1
        break;
      case "d":
        getFirst(player2).y += 1
        break;
    }
  }

}

function createGlueTrap() {
  if (getAll(glueTrap).length >= 1) {
    getAll(glueTrap)[getAll(glueTrap).length-1].remove()
  }
  addSprite(Math.floor(Math.random() * width()), Math.floor(Math.random() * height()), glueTrap)
  setTimeout(function() {
    getAll(glueTrap)[getAll(glueTrap).length-1].remove()
    createGlueTrap()
  }, 5000)
} createGlueTrap()

function drawScore() {
  addText("Water: " + scoreW, {x: 10, y: 0, color: color`5`})
  addText("Fire: " + scoreF, {x: 10, y: 2, color: color`3`})
}

function clear() {
  setMap(levels[level])
  clearText()
  finished = 0
  drawScore()
}
function touchingGlueTrap(playerWhich) {

  if (getAll(glueTrap).length === 0) return false
  if (playerWhich == "1") {
    for (let element of getAll(glueTrap)) {
      if (touching(getFirst(player), element)) return true
    }
  } else {
    for (let element of getAll(glueTrap)) {
      if (touching(getFirst(player2), element)) return true
    }
  }
  return false
}
function check() {
  if (finished) return;
  if (touching(getFirst(player), getFirst(p2base))) {
    scoreF += 1
    addText("Fire won!", {x: 0, y: 2, color: color`3`})
    drawScore()
    setTimeout(clear, 5000)
    finished = 1
    return
  } else if (touching(getFirst(player2), getFirst(p1base))) {
    scoreW += 1
    addText("Water won!", {x: 0, y: 2, color: color`5`})
    drawScore()
    setTimeout(clear, 5000)
    finished = 1
    return
  }
}

onInput("s", () => {
  move("1", "d")
})
onInput("k", () => {
  move("2", "d")
})
onInput("w", () => {
  move("1", "u")
})
onInput("i", () => {
  move("2", "u")
})
onInput("a", () => {
  move("1", "l")
})
onInput("j", () => {
  move("2", "l")
})
onInput("d", () => {
  move("1", "r")
})
onInput("l", () => {
  move("2", "r")
})
afterInput(() => {
    check()
})
setInterval(botMove, botMoveFreq)
drawScore()

Could you add this to my game?

@leolevd
Copy link
Contributor Author

leolevd commented Nov 11, 2025

Also, I see now I'm a contributor, do I have right to update my game myself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review Preliminary metadata check is complete, awaiting. review! triaged This PR has been triaged - awaiting reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants