mario needs to jump :(
Author |
Message |
Kactus
|
Posted: 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 can anyone suggest a way to get around this?
PS what do you think of it so far?
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
Jeremys Mario2.zip |
Filesize: |
255.5 KB |
Downloaded: |
100 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Kactus
|
Posted: 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
|
|
|
|
|
![](images/spacer.gif) |
NikG
|
Posted: 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.
|
|
|
|
|
![](images/spacer.gif) |
neufelni
|
|
|
|
![](images/spacer.gif) |
do_pete
![](http://i38.photobucket.com/albums/e112/do_pete/1943.gif)
|
Posted: 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
|
|
|
|
|
|
![](images/spacer.gif) |
Kactus
|
Posted: Thu Apr 20, 2006 12:07 pm Post subject: (No subject) |
|
|
thanks for the help guys!
|
|
|
|
|
![](images/spacer.gif) |
Imm0rtal
|
Posted: 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!
|
|
|
|
|
![](images/spacer.gif) |
Kactus
|
Posted: Sat Apr 22, 2006 12:47 pm Post subject: (No subject) |
|
|
haha thanks for pointing that out!
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|