Wednesday, March 2, 2011

Moving platforms

So far all the levels were designed with just three static colliding forms: rectangles, right rectangles and convex forms. All the floors were created implementing that forms or mixing them (looking for the desired floor). Being honest, after finishing five levels I felt like I was repeating the same puzzles over and over.

But in level six the moveable rectangular platforms appear. The next levels will be a mix of new features and puzzles with the old ones, providing a lot more of possibilities when I start the development of a new level.


Constructor:
        CFloorMovRec(QList<QPointF> lPos, QList<qreal> lSpeed, QList<int> lStopTime, bool bActive = true,
                     int iWidth = 0, int iHeight = 0, QPixmap pix = QPixmap());

The first list sends the positions the platform will move foward to, the second are the list with all the different speed between travel and travel, the third is a list with the time the platform is stopped before starting its movement again. bActive is used if we want a platform stopped (we need to activate it later). Width and height are used for the engine when the collisions are calculated and the pixmap is just a temporaly pixmap shown in the screen for testing purposes. When the final pixmaps are ready, all of them are hidden. So far all the floors in the videos uploaded are those "temporary collision floors".


Well, the code might seem too much complicated. I mean, why do you want to add a list with all the speeds? you can use just one, you can simplify it a lot removing the lists... but in my opinion making the things a bit more flexible give good results later. Work a bit more at the present so the code will be ready for improvements in the future.
In this case they show me its flexibility soon. I implemented the tipycal "falling floors when the characters is on them". You know, you are jumping to a new platform and you need to move forwards as fast as possible to the next platform because it's falling.
I implemented it and something weird happened. When the player was on the platform it went down after few miliseconds, but nothing noticed the player this could happen. In the games is usual to find elements warning the players of those things. I solved the problem "shaking" the platform when the character is on it, so he knows something "bad" is going to happen if he doesn't go forward as fas as possible. And "shake" the platform was as easy as adding more points and changing the speeds of the movements before the real fall starts. Being farsighted!


Level 7, called "RickDangerous"

1 comment:

  1. El video que hemos hecho no es el mejor ejemplo, no? Recuerdame que hagamos uno costito con las plataformas que se agitan y caen, te parece?

    bss :)

    ReplyDelete