
-----------------------------------
caseyjennifer
Tue Jan 24, 2012 7:15 pm

Help With Life Counter !
-----------------------------------
Kayso, I am doing a culminating activity for computer programming and the object of the game is to move the ball around and to avoid the edges, and if you hit an edge you lose a life, but every time i run my program and hit an edge it automatically goes 3 to 2 to 1 then to you died, but i don't know what i am doing wrong and i would like help with this, so i would like my program to minus a life every time you hit an edge then let the user keep playing 



var x : int
var y : int
x := 100
y := 100
var xspeed : int
var yspeed : int
xspeed := 0
yspeed := 0
var life : int
life := 3
var keys : array char of boolean

%Controls
loop
    Input.KeyDown (keys)
    if keys (KEY_UP_ARROW) and yspeed < 5 then
        yspeed += 1
    end if

    if keys (KEY_DOWN_ARROW) and yspeed > -5 then
        yspeed -= 1
    end if

    if keys (KEY_LEFT_ARROW) and xspeed > -5 then
        xspeed -= 1
    end if

    if keys (KEY_RIGHT_ARROW) and xspeed < 5 then
        xspeed += 1
    end if

    %If you crash
    if y >= 400 or y = 639 or x = 400 or y = 639 or x 

     end loop
     % Now they have left the menu (here you could check if they chose to quit 
     %     the game entirely and use another exit when statement)

     loop % The loop for your game

          < Insert code for game >
               % Within the game there should be a statement to check if the player has lost
               exit when < player has lost >

      end loop
      %  The player has lost, bring him back to the menu
end loop

Hope this helps.

-----------------------------------
caseyjennifer
Wed Jan 25, 2012 7:29 pm

RE:Help With Life Counter !
-----------------------------------
omg, for my life counter, i took RyGuy's idea of press any arrow key to continue, but when i typed it in and ran my program, when i was at 0 lifes it said you have 0 lives left press any arrow key to continue how do i change that so it doesnt say that when i get 0 lives?




    %Life Counter
    if y >= 400 or y 