Gravity Blocks


Awakening

Active Member
Joined
Mar 5, 2009
Messages
666
Location
Sweden
Website
www.digitalawakening.se
With Pandora coming out soon I wanted to learn C++ and SDL. I've coded quite a bit before but not in C++ so I decided to start on a simple little game. Gravity Blocks is a puzzle game where you combine blocks of the same color. As the name implies you can shift the gravity but the game also have different kinds of blocks. It's still early in development and I don't have a lot of time to work on this project right now. Chances are I'll complete it on my own Pandora.

This is a shot showing off the artwork I've done so far. The game allows you to change the "face plate" by simply loading in a different background, it will automatically add in the shadows and highlights etc. Here you can see what it looks like. This is in 25% scale, the details are really good in 800x480.

GravityBlocks01.jpg
 
Last edited by a moderator:
Thanks :)

It's not much of a system though, just a bit of clever artwork. I'll be doing the art for the blocks next, as soon as I have the time to spare.


Forgot to mention in my first post that this game will be played with the stylus, to move blocks around. Then you can use the arrows to the right or the d-pad to shift the gravity.
 
Last edited by a moderator:
I recommend that you finish the code first, otherwise you will spend half the time with artwork and then give up. Also artwork is usually really specific and can only be used in one project while code can be re-used elsewhere if you give up.
What I see is simple alpha blending and nothing special so far, I don't even get the game idea yet.. Sorry, but I think its a bit too early.
 
Last edited by a moderator:
'JayFoxRox' said:
I recommend that you finish the code first, otherwise you will spend half the time with artwork and then give up. Also artwork is usually really specific and can only be used in one project while code can be re-used elsewhere if you give up.
What I see is simple alpha blending and nothing special so far, I don't even get the game idea yet.. Sorry, but I think its a bit too early.
I have programmed more advanced stuff and bigger projects before so I'm not worried about the code really, it's just going to take some time getting used to C++ and SDL. I want to have the ingame art done before I start coding anything serious, it's more fun that way and it will be more interesting to follow the project as well. Once the block art is done I'll start on a level editor, which will be included. I'm not touching ingame mechanics until I can easily make, save and load levels, which will be very handy for testing.
 
Last edited by a moderator:
'JayFoxRox' said:
I recommend that you finish the code first, otherwise you will spend half the time with artwork and then give up. Also artwork is usually really specific and can only be used in one project while code can be re-used elsewhere if you give up.
What I see is simple alpha blending and nothing special so far, I don't even get the game idea yet.. Sorry, but I think its a bit too early.
The only projects I've ever finished were ones where I did all the artwork first.

Art is tough, and draining. Get it done, then write the game code overnight. :p
 
Last edited by a moderator:
I don't really mind doing the artwork, sometimes I really feel like it. But it depends, some tasks are just boring. I can only do simple stuff but I do them well, if I'm not happy with something I fix it. Those transparent arrows I put up doing for days but once I started I didn't stop until they where done.
 
Last edited by a moderator:
Looks a lot like a remake i'm doing for the nokia N810 (remake of gravnic which is included in puzznic for the nes).

Does it play by any chanse the same ?

This is a video of what i have so far
CODE

http://www.youtube.com/watch?v=fnmTLNURuME



btw i start mostly with the game mechanics itself and build around that hehe (ofcourse you do have to have some graphics so i create those first but that's not coding related).
Because i'm not sure if i can manage creating the game itself
 
Last edited by a moderator:
'joyrider' said:
Looks a lot like a remake i'm doing for the nokia N810 (remake of gravnic which is included in puzznic for the nes).
I remember Gravnic, haven't played that in ages. The gravity part of Gravity Blocks comes from that game but in my game you'll be able to move blocks with the stylus as well. I will also include different types of blocks. Since this type of game only have a small 2D array they are not so hard to work with when it comes to game mechanics. Collisions and physics are very simple and there's no AI etc etc.
 
Last edited by a moderator:
Ah cool, i was initially trying to remake puznic itself but that was too hard for me :( I had it partially working but i think it's the way i design my "World". You see i use a CWorldpart as a base class with a move draw method etc. Each of these also have a PlayFieldX,PlayFieldY, ScreenX and ScreenY. I then have a CWorldParts class that holds a "list" of CWorldpart again with move & draw methods which basicly all loop through the list and call CWorldpart->Draw etc. The problem comes whith checking for collisions or the CanMoveTo method. It will depend on how the list is "sorted" for example there could be 3 blocks in the CWorldParts list all placed under each other if the top most block (lowest PlayFieldY & ScreenY) is first in the list the block will not fall down when there is for example "some kind of gravity" implemented because the block below it hasn't moved yet. However if i sort the list from lowest PlayFieldY/SCreenY to hightest PlayfieldY/ScreenY it will move. It's just a simple example of the kinds of problems i'm running into (i can fix this one easily by using a parentlist in the CWorldPart class and checking if there is a block under it and then see if that one can move down and keep doing that for all the blocks below it. .... but more problems popped up while trying to get it to work.)

Anyway to make things short i was just wondering how you will use your 2d array. I mean when just having a 2darray equal to the number of tiles there can be in a row / column and setting the values you don't actually see the block moving from one position to another (that's why i used a playfield value and a screen value where the playfield value acts like an array index and the screen value is the actually screen position which could be between "2 indexes"). So will you use some kind of "transition" function to make the block move on the screen "smoothly" from one tile position to another one ? or are there other systems to do this ?

Just wondering cause i think i make it myselve way to hard :)
 
Last edited by a moderator:
One way to solve the problem is a list of all the blocks with all their possitions etc and a 2D array that represents the area that simply holds the index number of the block that currently occupies each space. To check if a block can move in a direction you check the 2D array. You should go through the 2D array from the bottom relative to the gravity and move blocks accordingly. If for example everything moves at the same speed then there's no need to check collisions between the blocks themselves. There are many ways to do the movement and it's not so hard when you don't have to worry about draw order and animations. For example figure out the final pixel positions of all the blocks (by working with the 2D array) and store those in the list then loop through the entire list of blocks until all have reached the end.
 
Last edited by a moderator:
Back
Top