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

Username:   Password: 
 RegisterRegister   
 mario needs to jump :(
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Kactus




PostPosted: Wed Apr 19, 2006 9:13 pm   Post subject: mario needs to jump :(

so ive have been working on my mario mini game for a bit now and its was going really well untill now. I can make mario jump but if you hold the Up button he floats in the air Confused can anyone suggest a way to get around this?

PS what do you think of it so far?



Jeremys Mario2.zip
 Description:
jeremys mario game

Download
 Filename:  Jeremys Mario2.zip
 Filesize:  255.5 KB
 Downloaded:  100 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Kactus




PostPosted: Wed Apr 19, 2006 9:18 pm   Post subject: (No subject)

forgot to include the keys to play:

left arrow = walk left
right arrow = walk right
up arrow = jump
down arrop = crouch
ctrl = run
NikG




PostPosted: Wed Apr 19, 2006 10:33 pm   Post subject: (No subject)

First off, let me say, this looks very promising!

Second, don't use processes!

Third (solution to your problem), keep a boolean variable that turns true once up is pressed and is false otherwise.
So when up is pressed and the boolean is already true, you know not to jump.
neufelni




PostPosted: Thu Apr 20, 2006 11:05 am   Post subject: (No subject)

Here is a mario game that I made. It's not that great and it uses processes but the jumping works fine.
http://www.compsci.ca/v2/viewtopic.php?t=11197
do_pete




PostPosted: Thu Apr 20, 2006 11:55 am   Post subject: (No subject)

Wow that looks very nice! First of, you don't need to have left and right images, you only need to have one direction and then you can create a mirrored version by using Pic.Mirror. Secondly, in order for Mario to jump, you should have a y-velocity variable. You would add this to your y variable every loop. Here's and example:
code:
View.Set ("offscreenonly,nobuttonbar,graphics:150,100")

const GRAVITY : real := 0.1
const RADIUS : int := 10
var y_velocity : real := 0
var y : real := RADIUS
var keys_pressed : array char of boolean

loop
    Input.KeyDown (keys_pressed)
    if y > RADIUS then
        y_velocity -= GRAVITY
    else
        y_velocity := 0
    end if

    if y_velocity = 0 and keys_pressed (KEY_UP_ARROW) then
        y_velocity := 2
    end if

    y += y_velocity

    Draw.FillOval (maxx div 2, round (y), RADIUS, RADIUS, black)
    View.Update
    cls
    delay (10)
end loop
Kactus




PostPosted: Thu Apr 20, 2006 12:07 pm   Post subject: (No subject)

thanks for the help guys!
Imm0rtal




PostPosted: Sat Apr 22, 2006 1:56 am   Post subject: (No subject)

Mari Goes down the Tube.. Mario Jumps back out the Tube.. Mario Goes down the Tube.. Mario Jumps back out the tube..

hehe.. Nice graphics though!
Kactus




PostPosted: Sat Apr 22, 2006 12:47 pm   Post subject: (No subject)

haha thanks for pointing that out!
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: