
-----------------------------------
ut2004
Thu Jun 12, 2008 2:15 pm

need help with health code
-----------------------------------
When health = 0
I want it so that the program doesn't end but it disallows the user to move the character after hes dead.

-----------------------------------
jeffgreco13
Thu Jun 12, 2008 2:29 pm

Re: need help with health code
-----------------------------------
it is really impossible to help when all were given is "health = 0"...

and what exactly do u mean? you want the guy or w/e to not be able to move but other things are still going on? the user can still interact with the progrm?

-----------------------------------
ut2004
Thu Jun 12, 2008 3:06 pm

Re: need help with health code
-----------------------------------
when my health intetger becomes 0 i want the guy to not be able to move but things are still going on

-----------------------------------
DemonWasp
Thu Jun 12, 2008 3:39 pm

RE:need help with health code
-----------------------------------
You're really going to have to explain more, and probably post a lot more of your code. We have no idea how you've implemented input handling / character movement, so we can't offer advice without knowing more.

Post your main game loop or similar structure here so we can understand what it is you're trying to do. Make sure you use the syntax tags when you do so:

[ syntax="turing ]
   code goes here...
[ / syntax ]

without spaces.

-----------------------------------
Tony
Thu Jun 12, 2008 3:46 pm

RE:need help with health code
-----------------------------------
exit the move procedure unless health > 0.

-----------------------------------
ut2004
Thu Jun 12, 2008 4:04 pm

Re: need help with health code
-----------------------------------

loop
        Input.KeyDown (chars)
        %-------------------MONK MOVEMENTS------------------------------------------------%
        %monk jump left
        if y > GROUND_HEIGHT and chars (KEY_LEFT_ARROW) then
            Pic.Draw (monkjumpleft, x, y, picMerge)

        end if

        %Go through platform
        if chars (KEY_DOWN_ARROW) then
            GROUND_HEIGHT := 20
        end if

        % to make the player move left
        if chars (KEY_LEFT_ARROW) then
            velx := -RUN_SPEED
            dir := 10
            monklll := monkleft
            monkjumpup := monkjumpleft
            if chars (KEY_LEFT_ARROW) and y = GROUND_HEIGHT then
                Pic.Draw (monkleft, x, y, picMerge)

            end if


            % to make the player move right
        elsif chars (KEY_RIGHT_ARROW) then
            velx := RUN_SPEED
            dir := -10
            monklll := monkright
            monkjumpup := monkjumpright

            if chars (KEY_RIGHT_ARROW) and y = GROUND_HEIGHT then
                Pic.Draw (monkright, x, y, picMerge)

            end if




            %monk jump right
            if y > GROUND_HEIGHT and chars (KEY_RIGHT_ARROW) then
                Pic.Draw (monkjumpright, x, y, picMerge)
            end if


        else
            velx := 0
        end if


        if y > GROUND_HEIGHT then
            Pic.Draw (monkjumpup, x, y, picMerge)
        end if
        if y = GROUND_HEIGHT then
            Pic.Draw (monklll, x, y, picMerge)
        end if
        % ---------------------------Jumping Monk-----------------
        if chars (KEY_UP_ARROW) and y = GROUND_HEIGHT then
            if Time.Elapsed - last3 > 720 then % delay after ever jump
                vely := JUMP_SPEED
                last3 := Time.Elapsed
            end if
        end if
        %-------MONK PROJECTILES-------
        if chars ('/') then
            %Pic.Draw (monkatkleft, x, y, picMerge)
            if Time.Elapsed - last > 800 then
                new bullet, upper (bullet) + 1
                bullet (upper (bullet)).x := x - dir
                bullet (upper (bullet)).y := y + 75
                bullet (upper (bullet)).dir := dir / .5
                last := Time.Elapsed
            end if
        end if
        for i : 1 .. upper (bullet)
            if i = x2 and bullet (i).y >= y2 and bullet (i).y  WALLRIGHT then
            x := WALLRIGHT
            vely2 := 0
        end if


        %-------------------WIZARD MOVEMENTS------------------------------------------------%
        %wizard jump left
        if y2 > GROUND_HEIGHT2 and chars ('a') then
            Pic.Draw (wizjumpleft, x2, y2, picMerge)
        end if

        %Go through platform
        if chars ('s') then
            GROUND_HEIGHT2 := 20
        end if

        % to make the player move left
        if chars ('a') then
            velx2 := -RUN_SPEED2
            dir2 := 10
            wizrrr := wizleft
            wizstand := wizjumpleft

            if chars ('a') and y2 = GROUND_HEIGHT2 then
                Pic.Draw (wizleft, x2, y2, picMerge)

            end if


            % to make the player move right
        elsif chars ('d') then
            velx2 := RUN_SPEED2
            dir2 := -10
            wizrrr := wizright
            wizstand := wizjumpright

            if chars ('d') and y2 = GROUND_HEIGHT2 then
                Pic.Draw (wizright, x2, y2, picMerge)

            end if




            %monk jump right
            if y2 > GROUND_HEIGHT2 and chars ('d') then
                Pic.Draw (wizjumpright, x2, y2, picMerge)
            end if


        else
            velx2 := 0
        end if
        if y2 > GROUND_HEIGHT2 then
            Pic.Draw (wizstand, x2, y2, picMerge)
        end if
        if y2 = GROUND_HEIGHT2 then
            Pic.Draw (wizrrr, x2, y2, picMerge)
        end if


        % ----------------------------------------Wizard jump-----------
        if chars ('w') and y2 = GROUND_HEIGHT2 then
            if Time.Elapsed - last4 > 720 then % delay after ever jump
                vely2 := JUMP_SPEED2
                last4 := Time.Elapsed
            end if
        end if
        %-------WIZ PROJECTILES-------
      


        if chars ('c') then



            if Time.Elapsed - last2 > 800 then
                new bullet2, upper (bullet2) + 1
                bullet2 (upper (bullet2)).x := x2 - dir2
                bullet2 (upper (bullet2)).y := y2 + 75
                bullet2 (upper (bullet2)).dir := dir2 / .5
                last2 := Time.Elapsed
            end if
        end if
        for i : 1 .. upper (bullet2)
            if i  WALLRIGHT then
            x2 := WALLRIGHT
            vely := 0
        end if
%---------------------------------Platforms-----------------------------------------%
        %platform left
        if x > 65 and x < 265 and y >= 325 then
            GROUND_HEIGHT := 325
            %------platform middle------
        elsif x > 250 and x < 680 and y >= 170 then
            GROUND_HEIGHT := 170
            %------platform right------
        elsif x > 660 and x < 905 and y >= 325 then
            GROUND_HEIGHT := 325

        else
            GROUND_HEIGHT := 20
        end if



        %drawfillbox (posx - 10, posy, posx + 10, posy + 20, 12)

        %if posxa >= maxx then
        % posxa := 1
        %end if
        %if posxa  65 and x2 < 265 and y2 >= 325 then
            GROUND_HEIGHT2 := 325
            %------------platform middle---------
        elsif x2 > 250 and x2 < 680 and y2 >= 170 then
            GROUND_HEIGHT2 := 170
            %------------platform right---------
        elsif x2 > 660 and x2 < 905 and y2 >= 325 then
            GROUND_HEIGHT2 := 325

        else
            GROUND_HEIGHT2 := 20
        end if

if health2 