Jump Script

I am making an RPG game with manual jumping. I want the jump to be composed of three parts

leaping
suspended
colliding with the floor again.

How would i code that using pyhton :spin:

I am using manual states

So if he is touching the floor, state == 1
Or else it will equal zero.

i am lost

So far this is what i have

if state == 1:
if space.isPositive();
mstate = 1
g.addActiveActuator(“Leap”)
if mstate = 1 and state !=1:
g.addActiveActuator(“Fall”)
if mstate == 1and FJ.isPositive(): # FJ is the Touch sensor
g.addActiveActuator(“Land”)

I couldn’t help but notice how quickly this thread is sinking to the bottom of the pile.
Honestly it just didn’t look like a very fun question to answer, mainly because it’s pretty vague; people like to answer questions that are narrowed down and developed (attributes that questions these days often lack).

Personally, I’ve never actually used the state system before; I strictly do everything in python now, so that makes me not of much of help to you, but I will do what I can.

There are some (many actually) errors in your python code: it looks like it’s all for 2.48 (old stinky style), and there are also some syntax problems. Below I have rewritten your code in my best attempt to recreate what you had there in a more complete Blender 2.49 styled way. Your code there had no indentation, so I just guessed the structure (could be totally wrong). I’ve really got to go to sleep, so see you later.


### Basic stuff
import GameLogic as gl
con = gl.getCurrentController()
own = con.owner

### Getting sensors
FJ = con.sensors["FJ"].positive
space = con.sensors["space"].positive

### Getting actuators
Leap = con.actuators["Leap"]
Fall = con.actuators["Fall"]
Land = con.actuators["Land"]

### The real action

# If you're touchin' the floor...
if own["state"] == 1: # state and mstate are properties I'm guessing?
    # and hittin' space
    if space:
        # then activate Leap (hey, that makes sense!)
        con.activate(Leap)
        # Then set mstate to one? what is this for?
        own["mstate"] = 1

# If you're NOT touchin' the floor...
else:
    # and you had hit space while touching the floor in the past...
    if own["mstate"] == 1:
        # Then do the fall thing
        con.activate(Fall)
        # You didn't do this, but I'm guessing you're gonna want to reset
        # mstate to 0 at some point, so it should probably be here?
        own["mstate"] = 0

if own["mstate"] == 1 and FJ:
    con.activate(Land)

Perfect!!!

Thank you

I normally indent, just that when i copied and pasted all the indention went away.
I am new to blender artist.

How can i make you a friend, i too am trying to code a whole game in python.

Thank You :wink: U Da Best!!!