Computer Science Canada

Stickman Kicking but wont reset to normal

Author:  customae7 [ Wed May 23, 2007 11:40 am ]
Post subject:  Stickman Kicking but wont reset to normal

I have managed to create two stickman that move and jump, player 1 will kick but it stays that way. I have added a elsif stament that should put it back to normal but its not working. If someone could figure out how to cotinually press space to have the guy keep kicking in a row right now I wont draw him normal take a look.

Author:  Tallguy [ Thu May 24, 2007 12:11 pm ]
Post subject:  RE:Stickman Kicking but wont reset to normal

post the program and let others have a look at it

Author:  customae7 [ Thu May 24, 2007 12:20 pm ]
Post subject:  Re: Stickman Kicking but wont reset to normal

setscreen ("offscreenonly")
type Coord :
record
x, y : int
end record

type Position :
record
Head : Coord
Torso : Coord
LeftArm : Coord
LeftWrist : Coord
%LeftHand : Coord
RightArm : Coord
RightWrist : Coord
%RightHand : Coord
LeftThigh : Coord
LeftLeg : Coord
%LeftFoot : Coord
RightThigh : Coord
RightLeg : Coord
%RightFoot : Coord
end record

function PosStanding (x, y : int) : Position
var person : Position
person.Head.x := x %Setting Head equal to x to be set later
person.Head.y := y %Setting Head equal to y to be set later
person.Torso.x := x %Setting Torso equal to x
person.Torso.y := y - 50 %Drawing Torso
person.LeftArm.x := x + 20 %Drawing leftarm x positon
person.LeftArm.y := y - 30 %Drawing leftarm y positon
person.LeftWrist.x := x + 25 %Drawing leftwrist x positon
person.LeftWrist.y := y - 15 %Drawing leftwrist y positon
person.RightArm.x := x - 15 %Drawing rightarm x positon
person.RightArm.y := y - 35 %Drawing rightarm y positon
person.RightWrist.x := x + 5 %Drawing rightwrist x positon
person.RightWrist.y := y - 25 %Drawing rightwrist y positon
person.LeftThigh.x := x + 15 %Drawing leftthigh x positon
person.LeftThigh.y := y - 65 %Drawing leftthigh y positon
person.LeftLeg.x := x + 20 %Drawing LeftLeg x positon
person.LeftLeg.y := y - 85 %Drawing LeftLeg y positon
person.RightThigh.x := x - 4 %Drawing RightThigh x positon
person.RightThigh.y := y - 65 %Drawing RightThigh y positon
person.RightLeg.x := x - 10 %Drawing RightLeg x positon
person.RightLeg.y := y - 85 %Drawing RightLeg y positon
result person
end PosStanding

function PosPunching (x, y, posNum : int) : Position
var person : Position
if posNum = 1 or posNum = 3 then
person.Head.x := x %Setting Head equal to x to be set later
person.Head.y := y %Setting Head equal to y to be set later
person.Torso.x := x %Setting Torso equal to x
person.Torso.y := y - 50 %Drawing Torso
person.LeftArm.x := x + 35 %Drawing leftarm x positon
person.LeftArm.y := y - 30 %Drawing leftarm y positon
person.LeftWrist.x := x + 35 %Drawing leftwrist x positon
person.LeftWrist.y := y - 30 %Drawing leftwrist y positon
person.RightArm.x := x - 15 %Drawing rightarm x positon
person.RightArm.y := y - 35 %Drawing rightarm y positon
person.RightWrist.x := x + 5 %Drawing rightwrist x positon
person.RightWrist.y := y - 25 %Drawing rightwrist y positon
person.LeftThigh.x := x + 15 %Drawing leftthigh x positon
person.LeftThigh.y := y - 65 %Drawing leftthigh y positon
person.LeftLeg.x := x + 20 %Drawing LeftLeg x positon
person.LeftLeg.y := y - 85 %Drawing LeftLeg y positon
person.RightThigh.x := x - 4 %Drawing RightThigh x positon
person.RightThigh.y := y - 65 %Drawing RightThigh y positon
person.RightLeg.x := x - 10 %Drawing RightLeg x positon
person.RightLeg.y := y - 85 %Drawing RightLeg y positon
elsif posNum = 2 then
person.Head.x := x %Setting Head equal to x to be set later
person.Head.y := y %Setting Head equal to y to be set later
person.Torso.x := x %Setting Torso equal to x
person.Torso.y := y - 50 %Drawing Torso
person.LeftArm.x := x + 20 %Drawing leftarm x positon
person.LeftArm.y := y - 30 %Drawing leftarm y positon
person.LeftWrist.x := x + 25 %Drawing leftwrist x positon
person.LeftWrist.y := y - 15 %Drawing leftwrist y positon
person.RightArm.x := x - 15 %Drawing rightarm x positon
person.RightArm.y := y - 35 %Drawing rightarm y positon
person.RightWrist.x := x + 5 %Drawing rightwrist x positon
person.RightWrist.y := y - 25 %Drawing rightwrist y positon
person.LeftThigh.x := x + 15 %Drawing leftthigh x positon
person.LeftThigh.y := y - 65 %Drawing leftthigh y positon
person.LeftLeg.x := x + 20 %Drawing LeftLeg x positon
person.LeftLeg.y := y - 85 %Drawing LeftLeg y positon
person.RightThigh.x := x - 4 %Drawing RightThigh x positon
person.RightThigh.y := y - 65 %Drawing RightThigh y positon
person.RightLeg.x := x - 10 %Drawing RightLeg x positon
person.RightLeg.y := y - 85 %Drawing RightLeg y positon
end if
result person
end PosPunching

function PosKicking (x, y, posNum : int) : Position
var person : Position
if posNum = 1 or posNum = 3 then
person.Head.x := x
person.Head.y := y
person.Torso.x := x
person.Torso.y := y - 50
person.LeftArm.x := x + 20
person.LeftArm.y := y - 30
person.LeftWrist.x := x + 25
person.LeftWrist.y := y - 15
person.RightArm.x := x - 15
person.RightArm.y := y - 35
person.RightWrist.x := x + 5
person.RightWrist.y := y - 25
person.LeftThigh.x := x + 35
person.LeftThigh.y := y - 65
person.LeftLeg.x := x + 35
person.LeftLeg.y := y - 65
person.RightThigh.x := x - 4
person.RightThigh.y := y - 65
person.RightLeg.x := x - 10
person.RightLeg.y := y - 85
elsif posNum = 2 then
person.Head.x := x
person.Head.y := y
person.Torso.x := x
person.Torso.y := y - 50
person.LeftArm.x := x + 20
person.LeftArm.y := y - 30
person.LeftWrist.x := x + 25
person.LeftWrist.y := y - 15
person.RightArm.x := x - 15
person.RightArm.y := y - 35
person.RightWrist.x := x + 5
person.RightWrist.y := y - 25
person.LeftThigh.x := x + 15
person.LeftThigh.y := y - 65
person.LeftLeg.x := x + 20
person.LeftLeg.y := y - 85
person.RightThigh.x := x - 4
person.RightThigh.y := y - 65
person.RightLeg.x := x - 10
person.RightLeg.y := y - 85
end if
result person
end PosKicking

function PosWalking (x, y, positionNum : int) : Position
var person : Position
if positionNum = 1 then
person.Head.x := x
person.Head.y := y
person.Torso.x := x
person.Torso.y := y - 50
person.LeftArm.x := x + 20
person.LeftArm.y := y - 30
person.LeftWrist.x := x + 25
person.LeftWrist.y := y - 15
person.RightArm.x := x - 15
person.RightArm.y := y - 35
person.RightWrist.x := x + 5
person.RightWrist.y := y - 25
person.LeftThigh.x := x + 15
person.LeftThigh.y := y - 65
person.LeftLeg.x := x + 20
person.LeftLeg.y := y - 85
person.RightThigh.x := x + 5
person.RightThigh.y := y - 65
person.RightLeg.x := x - 1
person.RightLeg.y := y - 85
elsif positionNum = -1 then
person.Head.x := x
person.Head.y := y
person.Torso.x := x
person.Torso.y := y - 50
person.LeftArm.x := x + 20
person.LeftArm.y := y - 30
person.LeftWrist.x := x + 25
person.LeftWrist.y := y - 15
person.RightArm.x := x - 15
person.RightArm.y := y - 35
person.RightWrist.x := x + 5
person.RightWrist.y := y - 25
person.LeftThigh.x := x + 10
person.LeftThigh.y := y - 65
person.LeftLeg.x := x + 5
person.LeftLeg.y := y - 85
person.RightThigh.x := x - 4
person.RightThigh.y := y - 65
person.RightLeg.x := x - 10
person.RightLeg.y := y - 85
end if
result person
end PosWalking

function PosJumping (x, y, posNum : int) : Position
var person : Position
if posNum = 1 or posNum = 3 then
person.Head.x := x
person.Head.y := y + 10
person.Torso.x := x
person.Torso.y := y - 40
person.LeftArm.x := x + 20
person.LeftArm.y := y - 20
person.LeftWrist.x := x + 25
person.LeftWrist.y := y - 5
person.RightArm.x := x - 15
person.RightArm.y := y - 25
person.RightWrist.x := x + 5
person.RightWrist.y := y - 15
person.LeftThigh.x := x + 15
person.LeftThigh.y := y - 45
person.LeftLeg.x := x + 11
person.LeftLeg.y := y - 65
person.RightThigh.x := x - 10
person.RightThigh.y := y - 45
person.RightLeg.x := x - 5
person.RightLeg.y := y - 65
elsif posNum = 2 then
person.Head.x := x
person.Head.y := y + 25
person.Torso.x := x
person.Torso.y := y - 25
person.LeftArm.x := x + 20
person.LeftArm.y := y - 5
person.LeftWrist.x := x + 25
person.LeftWrist.y := y + 10
person.RightArm.x := x - 15
person.RightArm.y := y - 10
person.RightWrist.x := x + 5
person.RightWrist.y := y
person.LeftThigh.x := x + 15
person.LeftThigh.y := y - 20
person.LeftLeg.x := x + 11
person.LeftLeg.y := y - 40
person.RightThigh.x := x - 10
person.RightThigh.y := y - 20
person.RightLeg.x := x - 5
person.RightLeg.y := y - 40
end if
result person
end PosJumping

function PosTurning (x, y, posNum : int) : Position
var person : Position
person.Head.x := x
person.Head.y := y
person.Torso.x := x
person.Torso.y := y - 50
person.LeftArm.x := x + 20
person.LeftArm.y := y - 30
person.LeftWrist.x := x - 1
person.LeftWrist.y := y - 30
person.RightArm.x := x - 15
person.RightArm.y := y - 35
person.RightWrist.x := x - 25
person.RightWrist.y := y - 25
person.LeftThigh.x := x + 4
person.LeftThigh.y := y - 65
person.LeftLeg.x := x + 10
person.LeftLeg.y := y - 85
person.RightThigh.x := x - 15
person.RightThigh.y := y - 65
person.RightLeg.x := x - 15
person.RightLeg.y := y - 85
result person
end PosTurning

function PosStanding2 (x, y : int) : Position
var person2 : Position
person2.Head.x := x
person2.Head.y := y
person2.Torso.x := x
person2.Torso.y := y - 50
person2.LeftArm.x := x + 20
person2.LeftArm.y := y - 30
person2.LeftWrist.x := x - 1
person2.LeftWrist.y := y - 30
person2.RightArm.x := x - 15
person2.RightArm.y := y - 35
person2.RightWrist.x := x - 25
person2.RightWrist.y := y - 25
person2.LeftThigh.x := x + 4
person2.LeftThigh.y := y - 65
person2.LeftLeg.x := x + 10
person2.LeftLeg.y := y - 85
person2.RightThigh.x := x - 15
person2.RightThigh.y := y - 65
person2.RightLeg.x := x - 15
person2.RightLeg.y := y - 85
result person2
end PosStanding2

function PosWalking2 (x, y, positionNum : int) : Position
var person2 : Position
if positionNum = 1 then
person2.Head.x := x
person2.Head.y := y
person2.Torso.x := x
person2.Torso.y := y - 50
person2.LeftArm.x := x + 20
person2.LeftArm.y := y - 30
person2.LeftWrist.x := x - 1
person2.LeftWrist.y := y - 30
person2.RightArm.x := x - 15
person2.RightArm.y := y - 35
person2.RightWrist.x := x - 25
person2.RightWrist.y := y - 25
person2.LeftThigh.x := x - 1
person2.LeftThigh.y := y - 65
person2.LeftLeg.x := x + 10
person2.LeftLeg.y := y - 85
person2.RightThigh.x := x - 15
person2.RightThigh.y := y - 65
person2.RightLeg.x := x - 15
person2.RightLeg.y := y - 85
elsif positionNum = -1 then
person2.Head.x := x
person2.Head.y := y
person2.Torso.x := x
person2.Torso.y := y - 50
person2.LeftArm.x := x + 20
person2.LeftArm.y := y - 30
person2.LeftWrist.x := x - 1
person2.LeftWrist.y := y - 30
person2.RightArm.x := x - 15
person2.RightArm.y := y - 35
person2.RightWrist.x := x - 5
person2.RightWrist.y := y - 25
person2.LeftThigh.x := x + 4
person2.LeftThigh.y := y - 65
person2.LeftLeg.x := x + 10
person2.LeftLeg.y := y - 85
person2.RightThigh.x := x - 4
person2.RightThigh.y := y - 65
person2.RightLeg.x := x - 10
person2.RightLeg.y := y - 85
end if
result person2
end PosWalking2

function TurnAround2 (x, y, posNum : int) : Position
var person2 : Position
person2.Head.x := x %Setting Head equal to x to be set later
person2.Head.y := y %Setting Head equal to y to be set later
person2.Torso.x := x %Setting Torso equal to x
person2.Torso.y := y - 50 %Drawing Torso
person2.LeftArm.x := x + 20 %Drawing leftarm x positon
person2.LeftArm.y := y - 30 %Drawing leftarm y positon
person2.LeftWrist.x := x + 25 %Drawing leftwrist x positon
person2.LeftWrist.y := y - 15 %Drawing leftwrist y positon
person2.RightArm.x := x - 15 %Drawing rightarm x positon
person2.RightArm.y := y - 35 %Drawing rightarm y positon
person2.RightWrist.x := x + 5 %Drawing rightwrist x positon
person2.RightWrist.y := y - 25 %Drawing rightwrist y positon
person2.LeftThigh.x := x + 15 %Drawing leftthigh x positon
person2.LeftThigh.y := y - 65 %Drawing leftthigh y positon
person2.LeftLeg.x := x + 20 %Drawing LeftLeg x positon
person2.LeftLeg.y := y - 85 %Drawing LeftLeg y positon
person2.RightThigh.x := x - 4 %Drawing RightThigh x positon
person2.RightThigh.y := y - 65 %Drawing RightThigh y positon
person2.RightLeg.x := x - 10 %Drawing RightLeg x positon
person2.RightLeg.y := y - 85 %Drawing RightLeg y positon
result person2
end TurnAround2

function PosJumping2 (x, y, posNum : int) : Position
var person2 : Position
if posNum = 1 or posNum = 3 then
person2.Head.x := x
person2.Head.y := y + 10
person2.Torso.x := x
person2.Torso.y := y - 40
person2.LeftArm.x := x + 20
person2.LeftArm.y := y - 20
person2.LeftWrist.x := x - 1
person2.LeftWrist.y := y - 20
person2.RightArm.x := x - 15
person2.RightArm.y := y - 25
person2.RightWrist.x := x - 25
person2.RightWrist.y := y - 15
person2.LeftThigh.x := x + 15
person2.LeftThigh.y := y - 45
person2.LeftLeg.x := x + 11
person2.LeftLeg.y := y - 65
person2.RightThigh.x := x - 10
person2.RightThigh.y := y - 45
person2.RightLeg.x := x - 5
person2.RightLeg.y := y - 65
elsif posNum = 2 then
person2.Head.x := x
person2.Head.y := y + 25
person2.Torso.x := x
person2.Torso.y := y - 25
person2.LeftArm.x := x + 20
person2.LeftArm.y := y - 5
person2.LeftWrist.x := x - 1
person2.LeftWrist.y := y - 10
person2.RightArm.x := x - 15
person2.RightArm.y := y - 10
person2.RightWrist.x := x - 25
person2.RightWrist.y := y
person2.LeftThigh.x := x + 15
person2.LeftThigh.y := y - 20
person2.LeftLeg.x := x + 11
person2.LeftLeg.y := y - 40
person2.RightThigh.x := x - 10
person2.RightThigh.y := y - 20
person2.RightLeg.x := x - 5
person2.RightLeg.y := y - 40
end if
result person2
end PosJumping2

function PosPunching2 (x, y, posNum : int) : Position
var person2 : Position
if posNum = 1 or posNum = 3 then
person2.Head.x := x
person2.Head.y := y
person2.Torso.x := x
person2.Torso.y := y - 50
person2.LeftArm.x := x + 20
person2.LeftArm.y := y - 30
person2.LeftWrist.x := x - 1
person2.LeftWrist.y := y - 30
person2.RightArm.x := x - 35
person2.RightArm.y := y - 30
person2.RightWrist.x := x - 35
person2.RightWrist.y := y - 30
person2.LeftThigh.x := x + 4
person2.LeftThigh.y := y - 65
person2.LeftLeg.x := x + 10
person2.LeftLeg.y := y - 85
person2.RightThigh.x := x - 15
person2.RightThigh.y := y - 65
person2.RightLeg.x := x - 15
person2.RightLeg.y := y - 85
elsif posNum = 2 then
person2.Head.x := x
person2.Head.y := y
person2.Torso.x := x
person2.Torso.y := y - 50
person2.LeftArm.x := x + 20
person2.LeftArm.y := y - 30
person2.LeftWrist.x := x - 1
person2.LeftWrist.y := y - 30
person2.RightArm.x := x - 15
person2.RightArm.y := y - 35
person2.RightWrist.x := x - 25
person2.RightWrist.y := y - 25
person2.LeftThigh.x := x + 4
person2.LeftThigh.y := y - 65
person2.LeftLeg.x := x + 10
person2.LeftLeg.y := y - 85
person2.RightThigh.x := x - 15
person2.RightThigh.y := y - 65
person2.RightLeg.x := x - 15
person2.RightLeg.y := y - 85
end if
result person2
end PosPunching2

function PosKicking2 (x, y, posNum : int) : Position
var person2 : Position
if posNum = 1 or posNum = 3 then
person2.Head.x := x
person2.Head.y := y
person2.Torso.x := x
person2.Torso.y := y - 50
person2.LeftArm.x := x + 20
person2.LeftArm.y := y - 30
person2.LeftWrist.x := x - 1
person2.LeftWrist.y := y - 30
person2.RightArm.x := x - 15
person2.RightArm.y := y - 35
person2.RightWrist.x := x - 25
person2.RightWrist.y := y - 25
person2.LeftThigh.x := x + 4
person2.LeftThigh.y := y - 65
person2.LeftLeg.x := x + 10
person2.LeftLeg.y := y - 85
person2.RightThigh.x := x - 35
person2.RightThigh.y := y - 65
person2.RightLeg.x := x - 35
person2.RightLeg.y := y - 65
elsif posNum = 2 then
person2.Head.x := x
person2.Head.y := y
person2.Torso.x := x
person2.Torso.y := y - 50
person2.LeftArm.x := x + 20
person2.LeftArm.y := y - 30
person2.LeftWrist.x := x - 1
person2.LeftWrist.y := y - 30
person2.RightArm.x := x - 15
person2.RightArm.y := y - 35
person2.RightWrist.x := x - 25
person2.RightWrist.y := y - 25
person2.LeftThigh.x := x + 4
person2.LeftThigh.y := y - 65
person2.LeftLeg.x := x + 10
person2.LeftLeg.y := y - 85
person2.RightThigh.x := x - 15
person2.RightThigh.y := y - 65
person2.RightLeg.x := x - 15
person2.RightLeg.y := y - 85
end if
result person2
end PosKicking2

procedure drawFigure (person2, person : Position)
drawoval (person.Head.x, person.Head.y, 10, 10, black) %head
drawline (person.Head.x, person.Head.y - 10, person.Torso.x, person.Torso.y, black) %torso
drawline (person.Head.x, person.Head.y - 18, person.LeftArm.x, person.LeftArm.y, black) %left arm
drawline (person.LeftArm.x, person.LeftArm.y, person.LeftWrist.x, person.LeftWrist.y, black) %left wrist
drawline (person.Head.x, person.Head.y - 18, person.RightArm.x, person.RightArm.y, black) %right arm
drawline (person.RightArm.x, person.RightArm.y, person.RightWrist.x, person.RightWrist.y, black) %right wrist
drawline (person.Torso.x, person.Torso.y, person.LeftThigh.x, person.LeftThigh.y, black) %left thigh
drawline (person.LeftThigh.x, person.LeftThigh.y, person.LeftLeg.x, person.LeftLeg.y, black) %left leg
drawline (person.Torso.x, person.Torso.y, person.RightThigh.x, person.RightThigh.y, black) %right thigh
drawline (person.RightThigh.x, person.RightThigh.y, person.RightLeg.x, person.RightLeg.y, black) %right leg
drawoval (person2.Head.x, person2.Head.y, 10, 10, black) %head
drawline (person2.Head.x, person2.Head.y - 10, person2.Torso.x, person2.Torso.y, black) %torso
drawline (person2.Head.x, person2.Head.y - 18, person2.LeftArm.x, person2.LeftArm.y, black) %left arm
drawline (person2.LeftArm.x, person2.LeftArm.y, person2.LeftWrist.x, person2.LeftWrist.y, black) %left wrist
drawline (person2.Head.x, person2.Head.y - 18, person2.RightArm.x, person2.RightArm.y, black) %right arm
drawline (person2.RightArm.x, person2.RightArm.y, person2.RightWrist.x, person2.RightWrist.y, black) %right wrist
drawline (person2.Torso.x, person2.Torso.y, person2.LeftThigh.x, person2.LeftThigh.y, black) %left thigh
drawline (person2.LeftThigh.x, person2.LeftThigh.y, person2.LeftLeg.x, person2.LeftLeg.y, black) %left leg
drawline (person2.Torso.x, person2.Torso.y, person2.RightThigh.x, person2.RightThigh.y, black) %right thigh
drawline (person2.RightThigh.x, person2.RightThigh.y, person2.RightLeg.x, person2.RightLeg.y, black) %right leg
end drawFigure

var Player2, Player1 : Position
var P1Head, P2Head : Coord
P2Head.x := 350 %Position of Player2 Head x position
P2Head.y := 85 %Position of Player2 Head y position
Player2 := PosStanding2 (P2Head.x, P2Head.y)
var chars : array char of boolean
var Moving, Moving2, Jumping, Jumping2, Kicking : boolean := false
var Kicking2, Turning2, Turning, Punching, Punching2 : boolean := false
var MoveNum, MoveNum2, JumpNum, JumpNum2, KickNum : int := 0
var KickNum2, TurnNum2, TurnNum, PunchNum, PunchNum2 : int := 0
var Matrix : int
Matrix := Pic.FileNew ("Matrix.jpg")
Matrix := Pic.Scale (Matrix, maxx, maxy)
P1Head.x := 250 %Position of Player1 Head x position
P1Head.y := 85 %Position of Player1 Head y position
Player1 := PosStanding (P1Head.x, P1Head.y) %Sets Player1 equal to position standing
Player2 := PosStanding2 (P2Head.x, P2Head.y) %Sets Player2 equal to position standing


loop
Pic.Draw (Matrix, 0, 0, picMerge)
Input.KeyDown (chars)
if not Moving and not Jumping then
if chars (KEY_RIGHT_ARROW) then
Moving := true
MoveNum := 1
P1Head.x += 5
Player1 := PosWalking (P1Head.x, P1Head.y, MoveNum)
elsif chars (KEY_LEFT_ARROW) then
Moving := true
MoveNum := -1
P1Head.x -= 5
Player1 := PosWalking (P1Head.x, P1Head.y, MoveNum)
end if
if chars (KEY_UP_ARROW) then
Jumping := true
JumpNum := 1
if Moving then
P1Head.x += 5 * sign (MoveNum)
end if
Player1 := PosJumping (P1Head.x, P1Head.y, JumpNum)
end if
if chars (KEY_DOWN_ARROW) then
Turning := true
TurnNum := 1
P1Head.x += 0
Player1 := PosTurning (P1Head.x, P1Head.y, TurnNum)
elsif Turning then
if TurnNum = 3 then
Player1 := PosStanding2 (P1Head.x, P1Head.y)
Turning := false
TurnNum := 0
else
TurnNum += 1
Player1 := PosTurning (P1Head.x, P1Head.y, TurnNum)
end if
end if
if chars ('p') then
Punching := true
PunchNum := 1
P1Head.x += 0
Player1 := PosPunching (P1Head.x, P1Head.y, PunchNum)
elsif Punching then
if PunchNum = 3 then
Player1 := PosStanding (P1Head.x, P1Head.y)
Punching := false
PunchNum := 0
else
PunchNum += 1
Player1 := PosPunching (P1Head.x, P1Head.y, PunchNum)
end if
end if
if chars (' ') then
Kicking := true
KickNum := 1
P1Head.x += 0
Player1 := PosKicking (P1Head.x, P1Head.y, KickNum)
elsif Kicking then
if KickNum = 3 then
Player1 := PosStanding (P1Head.x, P1Head.y)
Kicking := false
KickNum := 0
else
KickNum += 1
Player1 := PosKicking (P1Head.x, P1Head.y, KickNum)
end if
end if
else
if Moving and Jumping then
if JumpNum = 3 then
P1Head.x += 5 * sign (MoveNum)
Player1 := PosStanding (P1Head.x, P1Head.y)
Moving := false
Jumping := false
MoveNum := 0
JumpNum := 0
else
JumpNum += 1
P1Head.x += 5 * sign (MoveNum)
Player1 := PosJumping (P1Head.x, P1Head.y, JumpNum)
end if
elsif Moving then
if MoveNum > 0 then
MoveNum -= 1
P1Head.x += 5
Player1 := PosStanding (P1Head.x, P1Head.y)
Moving := false
elsif MoveNum < 0 then
MoveNum += 1
P1Head.x -= 5
Player1 := PosStanding (P1Head.x, P1Head.y)
Moving := false
end if
elsif Jumping then
if JumpNum = 3 then
Player1 := PosStanding (P1Head.x, P1Head.y)
Jumping := false
JumpNum := 0
else
JumpNum += 1
Player1 := PosJumping (P1Head.x, P1Head.y, JumpNum)
end if
end if
end if

if not Moving2 and not Jumping2 then
if chars ('d') then
Moving2 := true
MoveNum2 := 1
P2Head.x += 5
Player2 := PosWalking2 (P2Head.x, P2Head.y, MoveNum2)
elsif chars ('a') then
Moving2 := true
MoveNum2 := -1
P2Head.x -= 5
Player2 := PosWalking2 (P2Head.x, P2Head.y, MoveNum2)
end if
if chars ('w') then
Jumping2 := true
JumpNum2 := 1
if Moving2 then
P2Head.x += 5 * sign (MoveNum2)
end if
Player2 := PosJumping2 (P2Head.x, P2Head.y, JumpNum2)
end if
if chars ('s') then
Kicking2 := true
KickNum2 := 1
P2Head.x += 0
Player2 := PosKicking2 (P2Head.x, P2Head.y, KickNum2)
elsif Kicking2 then
if KickNum2 = 3 then
Player2 := PosStanding2 (P2Head.x, P2Head.y)
Kicking2 := false
KickNum2 := 0
else
KickNum2 += 1
Player2 := PosKicking2 (P2Head.x, P2Head.y, KickNum2)
end if
end if
if chars ('x') then
Turning2 := true
TurnNum2 := 1
P2Head.x += 0
Player2 := TurnAround2 (P2Head.x, P2Head.y, TurnNum2)
elsif Turning2 then
if TurnNum2 = 3 then
Player2 := PosStanding (P2Head.x, P2Head.y)
Turning2 := false
TurnNum2 := 0
else
TurnNum2 += 1
Player2 := TurnAround2 (P2Head.x, P2Head.y, TurnNum2)
end if
end if
if chars ('q') then
Punching2 := true
PunchNum2 := 1
P2Head.x += 0
Player2 := PosPunching2 (P2Head.x, P2Head.y, PunchNum2)
elsif Punching2 then
if PunchNum2 = 3 then
Player2 := PosStanding2 (P2Head.x, P2Head.y)
Punching2 := false
PunchNum2 := 0
else
PunchNum2 += 1
Player2 := PosPunching2 (P2Head.x, P2Head.y, PunchNum2)
end if
end if
else
if Moving2 and Jumping2 then
if JumpNum2 = 3 then
P2Head.x += 5 * sign (MoveNum2)
Player2 := PosStanding2 (P2Head.x, P2Head.y)
Moving2 := false
Jumping2 := false
MoveNum2 := 0
JumpNum2 := 0
else
JumpNum2 += 1
P2Head.x += 5 * sign (MoveNum2)
Player2 := PosJumping2 (P2Head.x, P2Head.y, JumpNum2)
end if
elsif Moving2 then
if MoveNum2 > 0 then
MoveNum2 -= 1
P2Head.x += 5
Player2 := PosStanding2 (P2Head.x, P2Head.y)
Moving2 := false
elsif MoveNum2 < 0 then
MoveNum2 += 1
P2Head.x -= 5
Player2 := PosStanding2 (P2Head.x, P2Head.y)
Moving2 := false
end if
elsif Jumping2 then
if JumpNum2 = 3 then
Player2 := PosStanding2 (P2Head.x, P2Head.y)
Jumping2 := false
JumpNum2 := 0
else
JumpNum2 += 1
Player2 := PosJumping2 (P2Head.x, P2Head.y, JumpNum2)
end if
end if
end if
drawFigure (Player2, Player1)
View.Update
delay (90)
cls
end loop


: