hello. i am YuminCoding.
i found my bug in my game.
could you fix my bugs in this game?
in this game, this bugs appears.
- text sprite can not appears when text sprite was multi appeared in 0.3s(score)
- the enemy can appears in toppest screen.
- the player can touch enemy when you die and relifed. relife position is
x 146, y 23
. - when game over,
wawawawaa
sound not appears. the appearing sound is another thing likebig crash
sound that appears when you touch enemy ormagic wand
sound when the enemy over passline. made by cuteyumin1004
text appears in not on center of screen.- the ball not fires on center of player plane, a little top of center.
and javascript code:
namespace SpriteKind {
export const Attack = SpriteKind.create()
export const Item = SpriteKind.create()
export const FastEnemy = SpriteKind.create()
export const invincible = SpriteKind.create()
export const passline = SpriteKind.create()
export const Life = SpriteKind.create()
export const Strong_attack = SpriteKind.create()
export const logo = SpriteKind.create()
}
controller.combos.attachCombo("bbb", function () {
music.play(music.melodyPlayable(music.siren), music.PlaybackMode.LoopingInBackground)
if (game.ask("really reset?", "score will set to 0.")) {
game.reset()
} else {
music.stopAllSounds()
music.play(music.createSoundEffect(WaveShape.Triangle, 1, 5000, 255, 0, 1000, SoundExpressionEffect.None, InterpolationCurve.Linear), music.PlaybackMode.InBackground)
game.splash("continue game.")
}
})
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
Attack_fire()
})
function logo_start () {
story.setSoundEnabled(false)
logo_ks = sprites.create(assets.image`Logo`, SpriteKind.logo)
pause(2000)
sprites.destroy(logo_ks)
pause(1000)
story.printText("cuteyumin1004 presents", scene.screenWidth() / 2, scene.screenWidth() / 2, 1, 15)
pause(500)
}
function Player_set () {
GalagaPlayer = sprites.create(assets.image`Galaga1P`, SpriteKind.Player)
GalagaPlayer.scale += 1
controller.moveSprite(GalagaPlayer, 0, 100)
GalagaPlayer.setStayInScreen(true)
GalagaPlayer.setPosition(146, 23)
status_bar_set()
}
sprites.onOverlap(SpriteKind.Enemy, SpriteKind.passline, function (sprite, otherSprite) {
music.play(music.melodyPlayable(music.magicWand), music.PlaybackMode.InBackground)
info.changeLifeBy(-1)
sprites.destroy(sprite, effects.trail, 500)
})
function howToPlay () {
story.printCharacterText("How to play")
story.printCharacterText("Press A button to fire a gun.")
story.printCharacterText("Press up & down button to move it your plane. left & right button cannot move it your plane.")
story.printCharacterText("Touch a star to make invincible to length of 2 musics. get double star make end invincible when last star end.")
story.printCharacterText("Touch a item looks like \"NC!\", makes get 10 scores.")
story.printCharacterText("Press B button 3 times to reset.")
story.printCharacterText("Don't make it the enemy pass the screen.")
}
sprites.onOverlap(SpriteKind.Item, SpriteKind.Player, function (sprite, otherSprite) {
info.changeScoreBy(10)
music.play(music.createSong(assets.song`ItemSound`), music.PlaybackMode.InBackground)
music.play(music.melodyPlayable(music.bigCrash), music.PlaybackMode.UntilDone)
sprites.destroy(item_Nuclear, effects.smiles, 500)
for (let index = 0; index < 20; index++) {
GalagaCPUEnemy = sprites.create(assets.image`GalagaEnemy`, SpriteKind.Enemy)
GalagaCPUEnemy.setVelocity(0, 0)
sprites.destroy(GalagaCPUEnemy, effects.spray, 500)
}
moreScore(10, sprite.x, sprite.y, -10)
})
sprites.onOverlap(SpriteKind.Strong_attack, SpriteKind.Player, function (sprite, otherSprite) {
sprites.destroy(sprite)
music.play(music.createSong(assets.song`Attacker`), music.PlaybackMode.InBackground)
info.changeScoreBy(20)
moreScore(20, otherSprite.x, otherSprite.y, 10)
})
sprites.onOverlap(SpriteKind.invincible, SpriteKind.Player, function (sprite, otherSprite) {
info.changeScoreBy(5)
music.play(music.createSong(assets.song`Invincible Item`), music.PlaybackMode.InBackground)
sprites.destroy(invincible_item)
invincible_is_activated = true
music.setVolume(79)
for (let index = 0; index < 2; index++) {
music.play(music.createSong(assets.song`invincible theme`), music.PlaybackMode.UntilDone)
}
music.setVolume(128)
invincible_is_activated = false
})
sprites.onOverlap(SpriteKind.Attack, SpriteKind.Enemy, function (sprite, otherSprite) {
info.changeScoreBy(1)
music.play(music.melodyPlayable(music.bigCrash), music.PlaybackMode.InBackground)
otherSprite.setVelocity(0, 0)
sprites.destroy(otherSprite, effects.fire, 500)
sprites.destroy(sprite)
moreScore(1, otherSprite.x, otherSprite.y, 10)
})
function Attack_fire () {
Attacker = sprites.create(assets.image`AttackBall`, SpriteKind.Attack)
Attacker.setPosition(GalagaPlayer.x - 5, GalagaPlayer.y + 1.4)
Attacker.scale += 2
Attacker.setVelocity(-100, 0)
}
sprites.onOverlap(SpriteKind.Player, SpriteKind.FastEnemy, function (sprite, otherSprite) {
if (invincible_is_activated) {
info.changeScoreBy(10)
sprites.destroy(otherSprite, effects.fire, 500)
moreScore(10, otherSprite.x, otherSprite.y, 10)
music.play(music.melodyPlayable(music.smallCrash), music.PlaybackMode.InBackground)
} else {
info.changeLifeBy(-1)
sprites.destroy(otherSprite)
music.play(music.melodyPlayable(music.smallCrash), music.PlaybackMode.InBackground)
sprites.destroy(sprite, effects.fire, 500)
pause(1500)
statusbar.value += -1
Player_set()
}
})
function status_bar_set () {
statusbar = statusbars.create(20, 4, StatusBarKind.Health)
statusbar.attachToSprite(GalagaPlayer)
statusbar.setColor(7, 2)
statusbar.setBarBorder(0.5, 13)
statusbar.value = info.life()
statusbar.max = 19
}
sprites.onOverlap(SpriteKind.FastEnemy, SpriteKind.passline, function (sprite, otherSprite) {
music.play(music.melodyPlayable(music.magicWand), music.PlaybackMode.InBackground)
info.changeLifeBy(-2)
sprites.destroy(sprite, effects.trail, 500)
})
function setup () {
plane_name = game.askForString("set your main plane name.", 3)
plane_number = game.askForString("set your plane number.", 6)
if (game.ask("see how to play info?", "press B to pass.")) {
howToPlay()
}
music.play(music.melodyPlayable(music.powerUp), music.PlaybackMode.InBackground)
game.splash("Plane " + plane_name + " " + plane_number, "Ready?")
info.setLife(19)
Player_set()
Passline = sprites.create(assets.image`passline`, SpriteKind.passline)
Passline.setPosition(157, 50)
Passline.sy += 4
Stage = 1
}
sprites.onOverlap(SpriteKind.Life, SpriteKind.Player, function (sprite, otherSprite) {
sprites.destroy(sprite)
music.play(music.melodyPlayable(music.magicWand), music.PlaybackMode.InBackground)
info.changeLifeBy(3)
})
sprites.onOverlap(SpriteKind.Attack, SpriteKind.FastEnemy, function (sprite, otherSprite) {
info.changeScoreBy(2)
music.play(music.melodyPlayable(music.pewPew), music.PlaybackMode.InBackground)
sprites.destroy(sprite)
statusbar2.value += -1
hcHealth += -1
if (hcHealth < 1) {
otherSprite.setVelocity(0, 0)
sprites.destroy(otherSprite, effects.fire, 500)
}
moreScore(2, otherSprite.x, otherSprite.y, 10)
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
if (invincible_is_activated) {
info.changeScoreBy(5)
sprites.destroy(otherSprite, effects.fire, 500)
moreScore(5, otherSprite.x, otherSprite.y, 10)
music.play(music.melodyPlayable(music.smallCrash), music.PlaybackMode.InBackground)
} else {
info.changeLifeBy(-1)
sprites.destroy(otherSprite)
music.play(music.melodyPlayable(music.smallCrash), music.PlaybackMode.InBackground)
sprites.destroy(sprite, effects.fire, 500)
pause(1500)
statusbar.value += -1
Player_set()
}
})
let GalagaFastCPUEnemy: Sprite = null
let Strong_attack2: Sprite = null
let Life_item: Sprite = null
let PositionY = 0
let PositionX = 0
let hcHealth = 0
let statusbar2: StatusBarSprite = null
let Stage = 0
let Passline: Sprite = null
let plane_number = ""
let plane_name = ""
let statusbar: StatusBarSprite = null
let Attacker: Sprite = null
let invincible_is_activated = false
let invincible_item: Sprite = null
let GalagaCPUEnemy: Sprite = null
let item_Nuclear: Sprite = null
let GalagaPlayer: Sprite = null
let logo_ks: Sprite = null
let textSprite: TextSprite = null
function moreScore (score: number, x: number, y: number, my: number = 10) {
textSprite = textsprite.create("+" + score)
textSprite.setPosition(x, y - my)
pause(300)
sprites.destroy(textSprite)
}
logo_start()
setup()
game.onUpdateInterval(1300 - info.score() * 5 - Stage * 50, function () {
if (Math.percentChance(1)) {
item_Nuclear = sprites.create(assets.image`Nuclear`, SpriteKind.Item)
item_Nuclear.setPosition(PositionX, PositionY)
item_Nuclear.setVelocity(30, 45)
item_Nuclear.setBounceOnWall(true)
} else if (Math.percentChance(4)) {
invincible_item = sprites.create(assets.image`Invincible`, SpriteKind.invincible)
invincible_item.setPosition(PositionX, PositionY)
invincible_item.setVelocity(50, 19)
invincible_item.setBounceOnWall(true)
} else if (Math.percentChance(4)) {
Life_item = sprites.create(assets.image`Life`, SpriteKind.Life)
Life_item.setPosition(PositionX, PositionY)
Life_item.setVelocity(50, 0)
} else if (Math.percentChance(3.7)) {
Strong_attack2 = sprites.create(img`
....................
....................
....................
....................
....................
....................
.....7977777777.....
.....7777777777.....
......66666666......
......99999999......
.....9999999999.....
.....9999999999.....
.....9999999999.....
.....9999999999.....
.....9999999999.....
.....9999999999.....
.....9999999999.....
......77777777......
....................
....................
`, SpriteKind.Strong_attack)
Strong_attack2.setVelocity(50, 0)
Strong_attack2.setPosition(PositionX, PositionY)
} else {
GalagaCPUEnemy = sprites.create(assets.image`GalagaEnemy`, SpriteKind.Enemy)
GalagaCPUEnemy.x = PositionX
GalagaCPUEnemy.y = PositionY
GalagaCPUEnemy.setVelocity(50, 0)
}
})
forever(function () {
let Strong_attack_stable = 0
PositionX = randint(10, 20)
PositionY = randint(scene.screenHeight() - 3, 1)
if (info.score() % 100 == 0 && info.score() != 0) {
music.play(music.createSong(assets.song`Level clear theme`), music.PlaybackMode.UntilDone)
Stage += 1
}
while (Strong_attack_stable) {
Attack_fire()
}
})
game.onUpdateInterval(30000, function () {
GalagaFastCPUEnemy = sprites.create(assets.image`GalagaFastEnemy`, SpriteKind.FastEnemy)
GalagaFastCPUEnemy.x = 0
GalagaFastCPUEnemy.y = PositionY
GalagaFastCPUEnemy.setVelocity(65, 0)
hcHealth = 5
statusbar2 = statusbars.create(20, 4, StatusBarKind.EnemyHealth)
statusbar2.value = 5
statusbar2.max = 5
statusbar2.attachToSprite(GalagaFastCPUEnemy)
})
could you show your game that fixed my game?
you can copy my code in
so, good luck!
by YuminCoding.