help just starting to code for school cant figure out why wont work
Author |
Message |
m6435
|
Posted: Wed Jun 07, 2017 9:09 am Post subject: help just starting to code for school cant figure out why wont work |
|
|
so i have to code a game and i haven't been coding that long so please dont judge just cant figure out what to do please help
sorry if unorganized
var x, y, life, amount, Enter : int
var chars : array char of boolean
var y1, y2, x1, x2, un : int
var x_size := 1080
var y_size := 720
View.Set ("graphics:" + intstr (x_size) + "," + intstr (y_size))
x1 := 470
y1 := 60
x2 := 500
y2 := 50
life := 2
y := 90
x := 110
amount := 0
locate (10, 40)
put "dont rush take your time things can kill you easy"
locate (20, 40)
put "use the arrow keys to move around"
locate (30, 40)
put "you only get 3 lives, good luck"
locate (1, 10)
put " Enter the number 1 to start"
get Enter
if Enter = 1 then
cls
loop
put y1, " ", y2
locate (2, 2)
put life
put "x ", x
put "y ", y
Draw.Box (75, 50, 1040, 700, red)
Input.KeyDown (chars)
drawoval (x, y, 10, 10, 1)
if chars (KEY_RIGHT_ARROW) then
delay (35)
cls
x := x + 10
if x >= 1040 then
x := x - 10
if x := x1 then
life := life - 1
end if
end if
if chars (KEY_LEFT_ARROW) then
delay (18)
cls
x := x - 5
if x <= 80 then
x := x + 10
end if
end if
if chars (KEY_UP_ARROW) then
delay (35)
cls
y := y + 10
if y >= 130 and x < 515 then
y := y - 10
end if
end if
if chars (KEY_DOWN_ARROW) then
delay (35)
cls
y := y - 10
if y <= 50 then
y := y + 10
end if
end if
Draw.FillBox (75, 130, 500, 140, green)
drawfillbox (x1, y1, x2, y2, black)
y1 := y1 + 1
y2 := y2 + 1
delay (5)
cls
if y1 = 140 and y2 = 130 then
loop
put y1, " ", y2
locate (2, 2)
put life
put "x ", x
put "y ", y
Draw.Box (75, 50, 1040, 700, red)
Input.KeyDown (chars)
drawoval (x, y, 10, 10, 1)
if chars (KEY_RIGHT_ARROW) then
delay (35)
cls
x := x + 10
if x >= 1040 then
x := x - 10
end if
end if
if chars (KEY_LEFT_ARROW) then
delay (18)
cls
x := x - 5
if x <= 80 then
x := x + 10
end if
end if
if chars (KEY_UP_ARROW) then
delay (35)
cls
y := y + 10
if y >= 130 and x < 515 then
y := y - 10
end if
end if
if chars (KEY_DOWN_ARROW) then
delay (35)
cls
y := y - 10
if y <= 50 then
y := y + 10
end if
end if
Draw.FillBox (75, 130, 500, 140, green)
drawfillbox (x1, y1, x2, y2, black)
y1 := y1 - 1
y2 := y2 - 1
delay (5)
cls
if y1 = 60 and y2 = 50 then
exit
end if
end loop
end if
end loop
end if
put "level 2 "
cls
loop
locate (2, 2)
put life
put "x ", x
put "y ", y
Draw.FillBox (75, 130, 500, 140, yellow)
Draw.Box (75, 50, 1040, 700, red)
Input.KeyDown (chars)
drawoval (x, y, 10, 10, 1)
if chars (KEY_RIGHT_ARROW) then
delay (35)
cls
x := x + 10
if x >= 1040 then
x := x - 10
end if
end if
if chars (KEY_LEFT_ARROW) then
delay (18)
cls
x := x - 5
if x <= 80 then
x := x + 10
end if
end if
if chars (KEY_UP_ARROW) then
delay (35)
cls
y := y + 10
if y >= 130 and x < 515 then
y := y - 10
end if
end if
if chars (KEY_DOWN_ARROW) then
delay (35)
cls
y := y - 10
if y <= 50 then
y := y + 10
end if
end if
end loop |
|
|
|
|
|
Sponsor Sponsor
|
|
|
ProxyKaliber
|
Posted: Wed Jun 07, 2017 9:37 am Post subject: Re: help just starting to code for school cant figure out why wont work |
|
|
You're missing an end if and you have a ":=" where it should just be "=".
Now it's up to you to figure out where... |
|
|
|
|
|
ProxyKaliber
|
Posted: Wed Jun 07, 2017 9:43 am Post subject: Re: help just starting to code for school cant figure out why wont work |
|
|
Also, is your level design complete or are you still working on that? I found the game to be quite choppy and the keys were very slow regarding reaction time. |
|
|
|
|
|
|
|