Jumping on the platform
Author |
Message |
zaid
|
Posted: Wed Jun 15, 2011 4:52 pm Post subject: Jumping on the platform |
|
|
What is it you are trying to achieve?
Making the character jump on platform
What is the problem you are having?
The problem i am having is trying to get my character to jump on the platform
Describe what you have tried to solve this problem
i have tried to change the jumpheight but it seems no use
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing: |
%Setscreen
setscreen ("graphics:640;480,nocursor,offscreenonly")
%Const
const Gravity := 2
const Ground := 20
%Vars
var lives := 3
var x := 100
var y := 100
var jumpheight := 0
var platform1LeftBoundary : int := 300
var platform1RightBoundary : int := 400
var platform1BottomBoundary : int := 60
var platform1TopBoundary : int := 62
var key : array char of boolean
%Images
var bg := Pic.FileNew ("bg.jpg")
var cont := Pic.FileNew ("controls.jpg")
%Intro
put "Welcome to Ultimate Jump!"
put "You are alone and trapped on Cloud island. "
put "Your only way out is to find the portals that will lead you home."
put "How do you get to the portals?"
put "Easy, jump your way up the obstacles and find it!"
put "Good Luck!"
put "-----------------------------------------------------------------"
put "Your Controls:"
Pic.Draw (cont, 70, - 20, picMerge)
View.Update
loop
exit when hasch
end loop
%Input of keys
loop
Input.KeyDown (key )
%UP
if key (KEY_UP_ARROW) and x > 0 and x < 640 and y <= 5 then
jumpheight := 20
end if
if key (KEY_UP_ARROW) and x > 300 and x < 400 and y <= 66 then
jumpheight := 20
end if
%LEFT
if key (KEY_LEFT_ARROW) and x > 10 then
x := x - 5
end if
%RIGHT
if key (KEY_RIGHT_ARROW) and x < 630 then
x := x + 5
%Exit when ESC is pressed
elsif key (KEY_ESC) then
cls
put "Thank You For Playing"
exit
end if
%Fixing up Gravity and jumping
jumpheight - = Gravity
y + = jumpheight
if y < 10 then
jumpheight := 7
end if
%Character
cls
Pic.Draw (bg, 0, 0, picMerge)
Draw.FillBox (x, y, x + 10, y + 10, red)
%Platform
drawfillbox (0, 0, 640, 5, blue)
%Creating Obstacles
drawfillbox (300, 60, 400, 62, 89)
%collision
if x > 300 and x < 400 and y > 62 and y < 66 then
jumpheight := 8
jumpheight - = Gravity
y + = jumpheight
end if
if x >= platform1LeftBoundary and x <= platform1RightBoundary and y <= platform1TopBoundary and y >= platform1BottomBoundary then
y := platform1TopBoundary
jumpheight := 0
end if
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
View.Update
delay (15)
cls
end loop
|
Please specify what version of Turing you are using
The latest, i think its 4.1
THANKS FOR YOUR HELP!
Description: |
|
Filesize: |
45.21 KB |
Viewed: |
116 Time(s) |
|
Description: |
|
Filesize: |
259.44 KB |
Viewed: |
115 Time(s) |
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|