Discord
Login
Community
DARK THEME

Does this make sense?

I'm working on Space-themed-sideways shooter game, I've looked at a tutorial for how to make projectiles but nothing is working an I don't know why. Can anyone explain? Here the link: https://microstudio.io/i/P1X3L_2012/spacequestr/

  blast = object end
  blast.x = 0
  blast.y = 0 
  blast.speed = 10
  blast.active = 0
end

fireBlast = function()
  if keyboard.press.SPACE and not blast1.active then
    blast.x = player.x + 10
    blast.y = player.y
    blast.active = 1
    end
end

moveBlast = function()
  if blast.active then
    blast.x += blast.speed
    if blast.x > 200 then
      blast.active = 0
      end
    end
end

drawBlast = function()
  if blast.active then
    screen.drawSprite("blast", blast.x,blast.y, 16, 16)
  end
end

Typos. Here is the corrected code for the bigger blast:

initBlast1 = function()
  blast1 = object end
  blast1.x = 0
  blast1.y = 0
  blast1.speed = 20
  blast1.active = 0
end

fireBlast1 = function()
  if keyboard.press.Q and not blast1.active then
    blast1.x = player.x + 20
    blast1.y = player.y
    blast1.active = 1
    end
end

moveBlast1 = function()
  if blast1.active then
    blast1.x += blast1.speed
    if blast1.x > 300 then
      blast1.active = 0
      end
    end
end

drawBlast1 = function()
  if blast1.active then
    screen.drawSprite("bigger_blst", blast1.x, blast1.y, 32, 32)
  end
end

That should be all the typos fixed.

Post a reply

Progress

Status

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