TalentJR apps
Raid! Run into their half on one breath, touch a defender and get back over the line — but don't let two catch you! Play it first, then open it in the Game Studio and change it until it is your own game.
🎮 Controls: arrow keys (or WASD) to run
At the top of the code are the settings — change one, run the game, and feel the difference. This is how game designers balance a game.
let raiderSpeed = 240 | How fast you run |
let breathTime = 6 | Seconds you can stay in their half (one breath!) |
let defenders = 4 | Players in the other team |
let chaseSpeed = 70 | How fast the defenders chase you |
let raids = 6 | Raids you get |
let target = 5 | Points you need to win |
let matColor = [234, 88, 12] |
Try them in order. The studio ticks each one off when your change works — and shows a hint if it does not.
let breathTime = 9let raiderSpeed = 320let chaseSpeed = 40let raids = 10let defenders = 6let target = 8let matColor = [22, 163, 74]110 lines of real JavaScript, made with TalentJR Game Studio's game library. Lines that start with // explain what the next part does.
// 🤼 Kabaddi — TalentJR Game Studio
// ✏️ Change these numbers, then press ▶ Run!
let raiderSpeed = 240 // how fast you run
let breathTime = 6 // seconds you can stay in their half (one breath!)
let defenders = 4 // players in the other team
let chaseSpeed = 70 // how fast the defenders chase you
let raids = 6 // raids you get
let target = 5 // points you need to win
let matColor = [234, 88, 12]
tj.setup({ background: "night" })
tj.touchControls("arrows")
// The mat: their half at the top, your half at the bottom, the middle line between
const LINE = 260
add([rect(560, 440), pos(40, 20), color(...matColor)])
add([rect(560, 6), pos(40, LINE - 3), color(255, 255, 255)])
add([text("THEIR HALF", { size: 16 }), pos(52, LINE - 26), color(255, 255, 255)])
add([text("YOUR HALF", { size: 16 }), pos(52, LINE + 10), color(255, 255, 255)])
// You are the raider (arrow keys)
const raider = tj.player({ x: 296, y: 380, speed: raiderSpeed, mode: "topdown" })
raider.onUpdate(() => {
raider.pos.x = Math.max(40, Math.min(552, raider.pos.x)) // stay on the mat
raider.pos.y = Math.max(20, Math.min(412, raider.pos.y))
})
// The defenders wait in their half — and chase you when you come in
for (let i = 0; i < defenders; i++) {
const home = vec2(80 + i * (460 / defenders), 80 + (i % 2) * 70)
add([sprite("robot"), pos(home), scale(0.75), color(59, 130, 246), "defender", { tagged: false, home: home }])
}
onUpdate("defender", (d) => {
if (raider.pos.y < LINE) d.move(raider.pos.sub(d.pos).unit().scale(chaseSpeed))
d.pos.y = Math.min(d.pos.y, LINE - 50) // defenders never leave their half
})
// Points, raids left and your breath
const score = tj.score()
let raidsLeft = raids
let raiding = false
let breath = 0
let tags = 0 // defenders you touched in this raid
const chant = add([text("", { size: 26 }), pos(width() / 2, 300), anchor("center"), color(255, 255, 255)])
const info = add([text("", { size: 18 }), pos(588, 30), anchor("topright"), color(255, 255, 255)])
function showInfo() {
info.text = "Raids left " + raidsLeft + " · Target " + target
}
showInfo()
// In their half you keep saying "Kabaddi!" — on ONE breath. Back over the line ends the raid
onUpdate(() => {
if (raider.pos.y < LINE) {
if (!raiding) {
raiding = true
breath = breathTime
tags = 0
}
breath = breath - dt()
chant.text = "Kabaddi! Kabaddi! " + Math.ceil(breath)
if (breath <= 0) endRaid("Out of breath!", false)
} else if (raiding) {
if (tags === 0) endRaid("Back home", true)
else endRaid("+" + tags + (tags === 1 ? " point!" : " points!"), true)
}
})
// Touch ONE defender to tag them — but if TWO catch you at once (touched or not), you are tackled!
onUpdate(() => {
if (!raiding) return
const near = get("defender").filter((d) => d.pos.dist(raider.pos) < 40)
if (near.length >= 2) endRaid("Tackled!", false)
else if (near.length === 1 && !near[0].tagged) {
near[0].tagged = true
near[0].color = rgb(148, 163, 184) // grey: touched
tags = tags + 1
tj.sound("pop")
}
})
// The raid ends: safe at home (points!), out of breath or tackled
function endRaid(words, safe) {
raiding = false
chant.text = ""
raidsLeft = raidsLeft - 1
if (safe && tags > 0) {
score.add(tags)
tj.sound("coin")
get("defender").forEach((d) => {
if (d.tagged) destroy(d) // the defenders you touched are out
})
} else if (!safe) {
tj.sound("hit")
shake(6)
}
get("defender").forEach((d) => { // everyone back to their places
d.tagged = false
d.color = rgb(59, 130, 246)
d.pos = d.home.clone()
})
raider.pos = vec2(296, 380)
say(words)
showInfo()
if (score.value >= target || get("defender").length === 0) tj.victory("Kabaddi champion!")
else if (raidsLeft <= 0) tj.gameOver("No raids left! " + score.value + " of " + target + " points")
}
function say(words) {
add([text(words, { size: 48 }), pos(width() / 2, 340), anchor("center"), color(255, 255, 255), opacity(1), lifespan(1.2, { fade: 0.5 })])
}
🏏 CricketTime your swing for a SIX, a FOUR or a run — and chase the target before you are all out.
⚽ FootballPenalty shootout: aim, kick and beat the goalkeeper — 3 goals from 5 shots.
🎯 Slime BlasterGuard the fence: move the robot, blast the slimes marching in — big ones need 3 hits.
🏃 Coin Run — your first gameType your first game yourself in 7 short missions — every line explained.
🏎️ Retro RacingDodge the traffic on a scrolling road — change the speed, the cars and the road colour.
🧗 PlatformerRun, jump over spikes, collect coins and reach the flag — then build your own level.