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

Username:   Password: 
 RegisterRegister   
 Need help with game
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
hojo12345




PostPosted: Mon Dec 19, 2011 1:26 pm   Post subject: Need help with game

What is it you are trying to achieve?
Hi ill get right to the point. I'm am trying to recreate frostbite for my class. I can't figure out how to make the guy jump like the guy in this video
http://www.youtube.com/watch?v=iajqWQjchjY&safety_mode=true&persist_safety_mode=1&safe=active

What is the problem you are having?
I can't figure out how to make the guy jump right


Describe what you have tried to solve this problem
i have tried different codes all have ended in disaster


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
i have tried this

Turing:


var PicFaceLeft, PicFaceRight : int

var x, y : int
x := 100
y := 100
var direction : int := 0
var chars : array char of boolean
View.Set ("offscreenonly")
PicFaceLeft := Pic.FileNew ("Person 1.jpg")
PicFaceRight := Pic.FileNew ("Person 2.jpg")

Pic.Draw (PicFaceRight, x, y, picMerge)
View.Update
loop
    drawfillbox (0, 0, 640, 400, 255)


    Pic.Draw (PicFaceRight, x, y, picMerge)

    Input.KeyDown (chars)

    if chars (KEY_UP_ARROW) then
        y := y + 5

    elsif chars (KEY_RIGHT_ARROW) then
        x := x + 5
        direction := 1
        Pic.Draw (PicFaceRight, x, y, picMerge)

    elsif chars (KEY_LEFT_ARROW) then
        Pic.Draw (PicFaceLeft, x, y, picMerge)
        x := x - 5
        direction := 2
    elsif chars (KEY_DOWN_ARROW) then
        y := y + 12

        if direction = 1 then
            x := x + 50
            Pic.Draw (PicFaceRight, x, y, picMerge)
        elsif direction = 2 then
            x := x - 50
            Pic.Draw (PicFaceLeft, x, y, picMerge)
        end if
        View.Update
        delay (100)
        y := y - 35
        if direction = 1 then

            Pic.Draw (PicFaceRight, x, y, picMerge)
        elsif direction = 2 then

            Pic.Draw (PicFaceLeft, x, y, picMerge)
        end if

    end if
    View.Update

    delay (10)


end loop



Please specify what version of Turing you are using
i am using turing 4.0.4c
Sponsor
Sponsor
Sponsor
sponsor
chipanpriest




PostPosted: Mon Dec 19, 2011 1:32 pm   Post subject: Re: Need help with game

hojo12345 @ Mon Dec 19, 2011 1:26 pm wrote:

Turing:

    elsif chars (KEY_RIGHT_ARROW) then
        x := x + 5
        direction := 1
        Pic.Draw (PicFaceRight, x, y, picMerge)

    elsif chars (KEY_LEFT_ARROW) then
        Pic.Draw (PicFaceLeft, x, y, picMerge)
        x := x - 5
        direction := 2


^This is what you have


This is what you need
Turing:

    elsif chars (KEY_RIGHT_ARROW) then
        Pic.Draw (PicFaceRight, x, y, picMerge)
        x := x + 5
        direction := 1

    elsif chars (KEY_LEFT_ARROW) then
        Pic.Draw (PicFaceLeft, x, y, picMerge)
        x := x - 5
        direction := 2
hojo12345




PostPosted: Mon Dec 19, 2011 1:40 pm   Post subject: Re: Need help with game

thanks i didn't know how t fix that but i need help on how to get the movement right
chipanpriest




PostPosted: Mon Dec 19, 2011 1:48 pm   Post subject: RE:Need help with game

Whats wrong with the movement?
hojo12345




PostPosted: Mon Dec 19, 2011 1:57 pm   Post subject: Re: Need help with game

i want the image to move like on the video
chipanpriest




PostPosted: Mon Dec 19, 2011 1:58 pm   Post subject: RE:Need help with game

aha i cant see the video cause im at school :p
hojo12345




PostPosted: Mon Dec 19, 2011 2:02 pm   Post subject: Re: Need help with game

you can't use Youtube at school i can
chipanpriest




PostPosted: Mon Dec 19, 2011 2:06 pm   Post subject: RE:Need help with game

lol no :/ it sucks, i know
Sponsor
Sponsor
Sponsor
sponsor
hojo12345




PostPosted: Mon Dec 19, 2011 2:13 pm   Post subject: Re: Need help with game

have you ever trying HTTPS
Dreadnought




PostPosted: Mon Dec 19, 2011 3:32 pm   Post subject: Re: Need help with game

I'm not sure if this will fix your problem, but its the first thing that caught my eye.

You have something like this
Turing:
if condition1 then

elsif condition2 then

elsif condition3 then

end if

When condition1 is true do condition2 and condition3 matter?
If this was intended then I apologize for bringing this up.
hojo12345




PostPosted: Mon Dec 19, 2011 3:53 pm   Post subject: Re: Need help with game

it's there to change my picture when i hit the left and right keys
Dreadnought




PostPosted: Mon Dec 19, 2011 7:08 pm   Post subject: Re: Need help with game

Yes, but your code wont change the picture while jumping. And you can only jump straight up (no sideways motion while jumping). And since your asking how to "jump right"...
Velocity




PostPosted: Mon Dec 19, 2011 7:46 pm   Post subject: RE:Need help with game

to jump right you want something like this
if KeyDown (RIGHT_ARROW_KEY) and keyDown ("Your jump key") then
x += 5 % how long you want to jump on the x scale
y += 5 % how high you want to jump on the y scale
x := x %make a new x coord for the previous command
y := y %make a new y coord for the previous command
end if

think about this in depth and you should get a solution in place.

RE : You must program the jump using a more enhanced program and implement the function use an open command.
if you dont want to do that then you can just make a key command for jump like i showed above without the "and" statement and then just press the right or left arrow key while you fall from your jump
or you can make seperate keys for jumping left and jump right and jumping up, and keys for just moving left, and right.
hojo12345




PostPosted: Tue Dec 20, 2011 7:40 am   Post subject: Re: Need help with game

i meant jump correctly i wanted to know if there is a way i can get an image or shape to be able to jump like the guy in the video i posted above
tg851




PostPosted: Wed Dec 21, 2011 11:15 am   Post subject: RE:Need help with game

i think he means the way the character itself moves when it jumps,arching over on the jump
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: