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

Username:   Password: 
 RegisterRegister   
 making characters jump
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Blade




PostPosted: Wed Apr 23, 2003 10:59 am   Post subject: making characters jump

how could you make a character jump? i mean, you import a picture of a lil dude, and you press a button to make it jump... i tried a for loop for jumping up and down and it worked pretty good... but i cant make him jump on an angle, as if you hold the up and right arrow keys...
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Apr 23, 2003 11:12 am   Post subject: (No subject)

The idea is that while jumping, he can still "walk" side to side. So while the jumping process is taking place, you would need to continue to read from input buffer and allow character to walk in the air... Perhas at a different speed
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
AsianSensation




PostPosted: Fri Apr 25, 2003 9:17 pm   Post subject: (No subject)

here is something that i used in my mario game(that is, before i changed it to Tactics: Mario), hopefully it will help you.

code:
var chars : array char of boolean
var x : int := 0
var y : real := 0

proc jump
    for angle : 0 .. 180 by 5
        Input.KeyDown (chars)
        if chars (KEY_RIGHT_ARROW) then
            x += 2
        end if
        if chars (KEY_LEFT_ARROW) then
            x -= 2
        end if
        y := 0
        y += 90 * sind (angle)
        drawfilloval (x, round (y), 5, 5, red)
        View.Update
        delay (25)
        drawfilloval (x, round (y), 5, 5, colorbg)
    end for
end jump

loop
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        jump
    end if
    if chars (KEY_RIGHT_ARROW) then
        x += 2
    end if
    if chars (KEY_LEFT_ARROW) then
        x -= 2
    end if
    drawfilloval (x, round (y), 5, 5, red)
    View.Update
    delay (10)
    drawfilloval (x, round (y), 5, 5, colorbg)
end loop
Homer_simpson




PostPosted: Fri Apr 25, 2003 10:46 pm   Post subject: (No subject)

try my bouncing post topic
http://www.compsci.ca/bbs/viewtopic.php?t=733&highlight=bounce
it might help
if you want it more specific check out my 2d shooter forum at
http://www.compsci.ca/bbs/viewtopic.php?t=525&highlight=2d+shooter
i have actually used the formula in there. i'm gonna put the code in the forum now
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 1  [ 4 Posts ]
Jump to:   


Style:  
Search: