Skip to content

Commit 2a30311

Browse files
authored
Capture_The_WebV2 (#3427)
* V2 * Fixed metadata
1 parent d94f2e1 commit 2a30311

File tree

1 file changed

+50
-38
lines changed

1 file changed

+50
-38
lines changed

games/Capture_The_Base.js

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*
1+
/*
22
@title: Capture The Base
33
@author: LeoLevd
4-
@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. Obstacles: pushy bots and smily glue traps.
5-
@tags: ['2P', 'BaseCapture', '2-Player']
4+
@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. Obstacles: Protector bots and glue traps
5+
@tags: ['2P', 'BaseCapture', '2-Player', 'Battle']
66
@addedOn: 2025-00-00
77
*/
88

@@ -15,10 +15,44 @@ const botF = "F"
1515
const botW = "W"
1616
const glueTrap = "g"
1717

18+
// CONFIG (Experimental)
19+
const botMoveFreq = 700
1820

1921

2022
setLegend(
21-
[ player, bitmap`
23+
[botF, bitmap`
24+
.D..H.H..H.H..D.
25+
DDDH.H.HH.H.HDDD
26+
.D..H.H..H.H..D.
27+
0D000000000000D0
28+
0333333333333330
29+
0332333333332330
30+
0329233333329230
31+
0329223333229230
32+
0329992332999230
33+
0332292332922330
34+
0333323333233330
35+
0333333333333330
36+
0333333333333330
37+
0333333333333330
38+
0333333333333330
39+
0000000000000000`], [botW, bitmap`
40+
.3..6.6..6.6..3.
41+
3336.6.66.6.6333
42+
.3..6.6..6.6..3.
43+
0300000000000030
44+
0555555555555550
45+
0552555555552550
46+
0527255555527250
47+
0527225555227250
48+
0527772552777250
49+
0552272552722550
50+
0555525555255550
51+
0555555555555550
52+
0555555555555550
53+
0555555555555550
54+
0555555555555550
55+
0000000000000000`], [ player, bitmap`
2256
................
2357
..33..33..3.....
2458
.333..393.3.....
@@ -98,39 +132,7 @@ setLegend(
98132
2244424224244444
99133
4442444444444444
100134
4442224444244424
101-
4444424444244444`], [botF, bitmap`
102-
.D..H.H..H.H..D.
103-
DDDH.H.HH.H.HDDD
104-
.D..H.H..H.H..D.
105-
0D000000000000D0
106-
0333333333333330
107-
0332333333332330
108-
0329233333329230
109-
0329223333229230
110-
0329992332999230
111-
0332292332922330
112-
0333323333233330
113-
0333333333333330
114-
0333333333333330
115-
0333333333333330
116-
0333333333333330
117-
0000000000000000`], [botW, bitmap`
118-
.3..6.6..6.6..3.
119-
3336.6.66.6.6333
120-
.3..6.6..6.6..3.
121-
0300000000000030
122-
0555555555555550
123-
0552555555552550
124-
0527255555527250
125-
0527225555227250
126-
0527772552777250
127-
0552272552722550
128-
0555525555255550
129-
0555555555555550
130-
0555555555555550
131-
0555555555555550
132-
0555555555555550
133-
0000000000000000`], [glueTrap, bitmap`
135+
4444424444244444`], [glueTrap, bitmap`
134136
...2222222222...
135137
...22222222222..
136138
..2221112222222.
@@ -182,6 +184,16 @@ setPushables({
182184

183185
function botMove() {
184186
if (finished) return;
187+
188+
189+
if (Math.abs(getFirst(player2).x - getFirst(p1base).x) <= 2 && Math.abs(getFirst(player2).y - getFirst(p1base).y) <= 2) {
190+
getFirst(botF).x = getFirst(p1base).x
191+
getFirst(botF).y = getFirst(p1base).y
192+
}
193+
if (Math.abs(getFirst(player).x - getFirst(p2base).x) <= 2 && Math.abs(getFirst(player).y - getFirst(p2base).y) <= 2) {
194+
getFirst(botW).x = getFirst(p2base).x
195+
getFirst(botW).y = getFirst(p2base).y
196+
}
185197
if (getFirst(botF).y != getFirst(player2).y) {
186198
if (getFirst(botF).y > getFirst(player2).y) {
187199
getFirst(botF).y -= 1
@@ -333,5 +345,5 @@ onInput("l", () => {
333345
afterInput(() => {
334346
check()
335347
})
336-
setInterval(botMove, 1000)
348+
setInterval(botMove, botMoveFreq)
337349
drawScore()

0 commit comments

Comments
 (0)