Hi all!
Im making a mario clone, and i was wondering how to write the jump function in the Mario class, any help would be good, im using PyGame by the way. heres my code so far:

#usr/bin/env python
import sys
import os

import pygame
from pygame.locals import *

class Mario():
    def __init__(self):
        self.image, self.rect = pygame.load_image('mario.png')
        self.health = 1
        self.alive = 1
    def walkRight():
        self.move()
    def walkLeft():
        self.-move()
    def jump():

THanks

Recommended Answers

All 4 Replies

Well what idea's do you have for writing a jump function. I guess you would have to think about a couple of things, What exactly is your motion path when you jump, how the direction of movement before hand effects the mothion path of the jump. Also you would need a method of checking whether or not you have landed/collided with another object.

Chris

The motion path would be like 70 or so pixels upwards, The direction of movement would be decided on the deriction that mario is moving, and the method for detecting collisions would be something like pygame.colide_get_rect() i think thats the name of that function.

So your set and know what you are doing. Trying coding something then coming back with specific problems

Chris

Ok, will do :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.