Ho, there’s nothing wrong with starting something new, don’t apologize. =P
Okay, I have the feeling you have some startup knowledge but I’ll start over again just to be sure we don,t miss anything.
Okay, so the logic in the game engine works by connecting sensors(that will wait that a specific event come) to actuators(that will produce an action) through controllers(that will pretty much control how the sensors have to be to activate the actuator). You also have a bunch of other things like the collision type, collision bound and other physical property. So far nothing new. An other thing you can do is to add a property to an object. For example, you could have a property called “life” to your character which would contain your character’s life. If you would want to influence this property when a certain event occurs, you would have to do it with a property actuator. If you would want a certain event to happens when your property reaches a certain value, you would have to do it with the property sensor.
And all that is pretty good because that’s what we want for your doublejump. So first, to add a property, you will have to press n in the game logic window. There you should see an “add property” button, press it. Now you have to know that there is multiple sorts of properties. You have boolean(true or false), integer(complete number like 1 -1 0 999999999), float(fractionnal numbers like 1,0 -875,974) and timer(pretty much like a float that goes down with time). Usually, people uses boolean for property that are true or false(like : is the character alive?), integer for number that are always full(like number of coins), float for fractionnal number(like time) and timer…when you feel like it. Note that float could do the job of integer but integer takes less memory and keep the code cleaner so I recommend to prefer it to float when you can. And ho!, there is also the string property. Well, string if for everything that contains letters like name of characters and things like that. For our situation, take an integer and give it an initial value of 0 and call it jump.
Now, the way we want to do it is that we want to increase this property by 1 each time the player press space. So the value will be 1 for the first jump, 2 for the second and so on. We also want to stop the player to jump once the property will = 2, this way he will only be able to jump twice. Finally, we want the jump property to go back to 0 once the player touches the ground, so he will be able to jump again.
So, we need a sensor that will trigger(get activated) each time the player will hit the ground. There are a couple of ways to do that but we’ll do it with the touch sensor. The way this sensor works it by triggering each time the object will touches a given material, so we just have to add a particular material to the ground that will trigger the sensor when the player touches it. Create a basic material and name it “ground”. God back to your sensor and add ground in the given space. Now, create a property actuator. This actuaor works by asking you how you want to influence the property, what property you want to influence and by what number. In our case, we want to reset the default value(0) of our jump property, remember? So just fill the space to make it do that.
Now, create a property sensor. This sensor will detect if our property jump is below 2 (use the interval option in the brick for this one). If the property is, then the sensor will be “true”. Connect this sensor to the the same controller your spacebar sensor is connected. the way it works is that if your controller is set to “AND”, it will check if all your sensors are true. If they are, then it will activate the actuator. As your jump property will increase with each jump, it will reach 2 after the second one and your property sensor will turn false, so the controller won’t let your character to jump anymore until it touches the ground, where the property will go back to 0 and your sensor will turn true again. All we have to do now is to increase the property after each jump. With all my explanations and my last post, you should be able to figure that part by yourself. I still have to let you learn a bit.
I think that, with this, you should be able to get it done. Hope it helped and that the explanations were clear.