
-----------------------------------
Kactus
Wed Apr 19, 2006 9:13 pm

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  :?  can anyone suggest a way to get around this?

PS what do you think of it so far?

-----------------------------------
Kactus
Wed Apr 19, 2006 9:18 pm


-----------------------------------
forgot to include the keys to play:

left arrow = walk left
right arrow = walk right
up arrow = jump
down arrop = crouch
ctrl = run

-----------------------------------
NikG
Wed Apr 19, 2006 10:33 pm


-----------------------------------
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
Thu Apr 20, 2006 11:05 am


-----------------------------------
Here is a mario game that I made. It's not that great and it uses processes but the jumping works fine.
[url=http://www.compsci.ca/v2/viewtopic.php?t=11197]http://www.compsci.ca/v2/viewtopic.php?t=11197

-----------------------------------
do_pete
Thu Apr 20, 2006 11:55 am


-----------------------------------
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:
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
Thu Apr 20, 2006 12:07 pm


-----------------------------------
thanks for the help guys!

-----------------------------------
Imm0rtal
Sat Apr 22, 2006 1:56 am


-----------------------------------
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
Sat Apr 22, 2006 12:47 pm


-----------------------------------
haha thanks for pointing that out!
