IOS source code for a JUMP-up stair game, and ios for a jump-up stair game
Cocos2d-x-based simple JUMP-up stair game with sound effects. It is suitable for new cocos2d students to learn. The rule is similar to a classic game of "men are on the 100 layer", that is, to control the baby to slowly increase by jumping on the pedal of different heights.
<Ignore_js_op>
Http://ios.662p.com/thread-1711-1-1.html
Detailed original code and Analysis of C language for monkey going up the stairs
20 minutes ......
Only give you ideas
Use array a [I] to record the minimum cost when a monkey reaches the I step. B [I] is the positive integer data on the input step.
Two-layer loop,
The first layer of cyclic I is from 1 to n, scanning the step of each layer
The second loop j is from 1 to k, if a [I + j] <a [I] + B [I + j] is updated to a [I] + B [I + j],
A [I] + B [I + j] indicates that the data on the I + j layer is added at the minimum cost of the Tier I,
If it is less than the temporary minimum cost on the I + j layer (because the minimum value is not determined yet ),
Update the I + j layer to make it smaller.
In this way, the minimum cost of a [n] can be obtained through step-by-step recursion.
The java source code of dow.jump should not be the simple version of CSDN. If I have it, I hope the work can be stronger.
Hi, it's been over the past year and a half. I wonder if you have found what you want?
I am also using cocos2dx to try a similar game.
I will tell you what I know:
The background is rolling. You write a ScrollScene in your game loop, operate the background image in this method, set its Y coordinate, Y = Y + ScrollSpeed; (or it may be-ScorllSpeed, depending on your Coordinate System) ScrollSpeed is set by yourself.
The springboard is also the same. First, write a CreateBlock method to create the springboard, and then add a DropBlock in the game loop. The same principle as ScrollScene changes the Y coordinate of the springboard. In combination with the background, it looks like the main character moves again.
Then, you can add the stepping stone in the main loop of the game to create a stepping stone, which requires random and upper limit of quantity control.
Finally, your logic may look like this:
// Gameloop
While (m_bRunning)
{
// Do other thing
//...
ScrollScene ();
DropBlock (); // determine whether the Block has fallen to the end. Pay attention to the destruction and collision detection.
If (rand (1) = 1 & m_curBlockCount <MAX_BLOCK)
CreateBlock ();
}
At present, I have come up with similar ideas. I want to do something more complicated than this, and I haven't figured it out in many places.
As long as you have ideas, writing code is very simple. For game developers, the first line of thinking is the second technology. It is the most important thing to use what you will.