Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Tutorial] How to Jump
Index -> Programming, Turing -> Turing Tutorials
Goto page Previous  1, 2, 3
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TopBypass




PostPosted: Sat Jan 19, 2008 11:53 am   Post subject: RE:[Tutorial] How to Jump

Is it possible to change the object from a box to an image?
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Sat Jan 19, 2008 12:38 pm   Post subject: RE:[Tutorial] How to Jump

Yes, instead of drawing your box, draw the image in it's place...
TopBypass




PostPosted: Sat Jan 19, 2008 12:51 pm   Post subject: RE:[Tutorial] How to Jump

i mean inserting an image.
Clayton




PostPosted: Sat Jan 19, 2008 2:24 pm   Post subject: RE:[Tutorial] How to Jump

It's the exact same thing. However, this really deserves it's own topic in [Turing Help], ask your question there.
Michael516




PostPosted: Fri Mar 14, 2008 2:18 pm   Post subject: Re: [Tutorial] How to Jump

thrivey if you still cant figure out how to put platforms in i have edited the how to jump program so that is has a platform in it
here it is...



gravity.t
 Description:
how to jump (edited)

Download
 Filename:  gravity.t
 Filesize:  2.15 KB
 Downloaded:  316 Time(s)

A.J




PostPosted: Sun Mar 16, 2008 4:21 pm   Post subject: Re: [Tutorial] How to Jump

just to add to this tutorial,
the example Michael516 gave is good, but make sure you can't jump up through the line
(it shouldn't be accessible up or down)

and make sure you can't go out of the screen (a couple more if statements)
Doug101




PostPosted: Wed Mar 26, 2008 7:11 pm   Post subject: Re: [Tutorial] How to Jump

Hey Micheal its Doug its a coll game but wat do these stand for "var velx, vely : real" im really confused? Confused
Mackie




PostPosted: Wed Mar 26, 2008 7:17 pm   Post subject: RE:[Tutorial] How to Jump

They stand for X Velocity and Y Velocity. Which is the speed the character is moving at for both x, and y axis.
Sponsor
Sponsor
Sponsor
sponsor
Doug101




PostPosted: Wed Mar 26, 2008 7:22 pm   Post subject: Re: [Tutorial] How to Jump

Thanks Mackie that explains alot Very Happy
Jujeff




PostPosted: Mon May 12, 2008 12:08 pm   Post subject: Re: [Tutorial] How to Jump

I've already posted this to collision detection, but I don't know where to really put it, so I put it here too. I'm new to here, and Turing (sort of) so I'm sorry if I appear a noob. I wanted to make a platformer for a school project, so I realized I needed to make my character jump. I found the highly-helpful Mazer Jump Tutorial, copied and pasted (there are some numbers I couldn't figure out the use of), and tweaked it to my needs.

After putting in a platform, I discovered that this messed everything up (the character cannot jump once on a platform), I tried to fix it as best as I could, and added in a boolean variable by recommendation of a friend, however as it is not clear to me the use of this, I will paste the code that I had before the boolean variable.

(The problem of the jumping of the platform, as far as I can see, is that the Yvelocity must be 0 to be able to jump, but the character can only be on the platform if Yvelocity is above the value of "gravity".)

Code:

setscreen ("graphics:1011;699;nobuttonbar;offscreenonly")

% VARIABLES!

var keystroke : array char of boolean

var height : int := 1
var LeftWall : int := 1
var RightWall : int := 1011
var movespeed : int := 10
var jumpspeed : int := 30
var gravity : int := 2

var Xposition, Yposition : int
var Xvelocity, Yvelocity : real

Xposition := 20
Yposition := 400
Xvelocity := 0
Yvelocity := 0

% game loop

loop

Input.KeyDown (keystroke)

% horizontal movement

if keystroke ('a') then
Xvelocity := -movespeed
elsif keystroke ('d') then
Xvelocity := movespeed
else
Xvelocity := 0
end if

% jump movement

if keystroke ('w') and Yposition = height then
Yvelocity := jumpspeed
end if
% world (lines and where you can walk and such)

drawline (0, height, maxx, height, blue)

drawline (245, 146, 384, 146, blue)

% line (if you're on the middle line, stay on it)

if Xposition >= 245 and Xposition <= 384 and Yposition >= 140 then

Yposition := 140
Yvelocity := 10
end if

% reinstate gravity every loop

Yvelocity -= gravity
Xposition += round (Xvelocity)
Yposition += round (Yvelocity)

% don't fall through the ground or go past the edges

if Yposition <= height then
Yposition := height
Yvelocity := 0
end if

if Xposition < LeftWall then
Xposition := 1
end if

if Xposition > RightWall then
Xposition := 1010
end if

% character (square for now)

drawfillbox (Xposition - 10, Yposition, Xposition + 10, Yposition + 20, green)

drawfillbox (Xposition - 10, Yposition, Xposition + 10, Yposition + 20, red)

% animation

View.Update
delay (25)
cls

end loop
Jujeff




PostPosted: Mon May 12, 2008 7:47 pm   Post subject: Re: [Tutorial] How to Jump

EDIT::: no need, answer is found
DaveAngus




PostPosted: Tue May 20, 2008 12:35 pm   Post subject: RE:[Tutorial] How to Jump

This tutorial is great and has helped me out a lot! Thanks Mazer!
SAMZ




PostPosted: Mon May 26, 2008 9:17 am   Post subject: Re: [Tutorial] How to Jump

What about a wall? How would I jump over and back with a wall?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 3 of 3  [ 43 Posts ]
Goto page Previous  1, 2, 3
Jump to:   


Style:  
Search: