Discord
Login
Community
DARK THEME

Title Screen

I’ve tried literally everything but my title screen won’t show. Can anyone help me?

Title Screen(main):

init = function()
  MuquanInit()
  initSpancer()
  initChicky()
  gameoverInit()
end
update = function()
  if mode == "title" then
  titleScreenUpdate()
  end
     if mode == "nothing" then
MuquanUpdate()
moveSpancer()
moveChicky()
shopKeeper()
end
gameoverUpdate()
end
draw = function()
  screen.clear("orange")
  if mode == "title" then
    screen.clear("orange")
titleScreenDraw()
end
  if mode == "shop" then
    shopDraw()
    end
  if mode == "nothing" then
    shopDraw()
  screen.clear("green")
  screen.drawMap("battle_zone",30,0,400,200)
  drawSpancer()
  drawChicky()
    MuquanDraw()
    shopDraw()
end
  gameroverDraw()
  end

Title Screen(code file):

titleScreenInit = function()
  mode = "title"
end
titleScreenUpdate = function()
  if keyboard.press.ENTER then
    mode = "nothing"
    end
end
titleScreenDraw = function()
    screen.clear("orange")
    screen.drawSprite("icon",0,0,100)
    screen.drawText("Muquan and Thamas",0,0,40)
    screen.drawText("TD: The Chosen One",0,-20,20)
  end

titleScreenInit() isnt called in init(), or at all. without that, mode is never set to "title" and titleScreenDraw() is never called

I’ve tried that and it’s still not working but I think it’s something in the “muquan” file?

MuquanInit = function()
  //muquan
  muquan = object end
  muquan.x = -145
  muquan.y = 10
  muquan.speed = 4.55
  //-----------------------------
  //projectile
  initMuquanProjectile()
  //SYSTEMS
  //coin currency
  points = 0
  doubleC = 6
  // score and high score
  score = 0
  highscore = storage.get("highscore")
  lives = 10
  enemycounter = 0
  wave = 0
  shop_status = false
end
MuquanUpdate = function()
  //Waves and stuf here
  if enemycounter == 25 then
    wave += 1
    enemycounter = 0
    end
  //Includes clamp if possible
  MuquanMovement()
  //projectile
  MuquanProjectile()
  muquan.y = clamp(muquan.y, -85,85)
  //highscore 
   if score>highscore then
        storage.set("highscore",score)
        highscore = score
   end
   //music (shop)
   if mode == "shop" then
   my_music = audio.playMusic("peak_song")
    my_music.setVolume(1)
  end
  //reboot stuff (scrapted)
  if mode == "gameover" then
  if keyboard.press.R then
  lives = 10
  mode = "nothing"
  MuquanInit()
  initChicky()
  initSpancer()
  end
  end
end
//Draw Muquan
MuquanDraw = function()
  if mode == "nothing"
  then
  screen.drawSprite("muquan",muquan.x,muquan.y,20)
  if points == 50 then
    screen.drawSprite("50x_counter",50,90,20)
    end
  screen.drawText("muquan coinz: "+ points,80,90,25,"white")
  screen.drawSprite("coin",-30,90,20)
  screen.drawSprite("lives",30,65,20)
  screen.drawText("lives: "+ lives,80,70,20)
  screen.drawText("Waves: " + wave,-45,-70,20)
  screen.drawText("SCORE: "+ score,45,-70,20)
  drawBlast()
end
end
//Projectiles
MuquanProjectile = function()
  fireBlast()
  moveBlast()
end
//Movement
MuquanMovement = function()
  //up and down movement
  if keyboard.UP then
    muquan.y += muquan.speed
  end
  if keyboard.DOWN then
    muquan.y -= muquan.speed
    end
  end

Oh never mind your advice worked.

calling the function is the only thing I can see wrong, all I can suggest is putting titleScreenInit() back in and going through the functions with print() to see what is and isn't getting called and going from there

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community