Help a beginner please!

Started by
1 comment, last by the Chef 21 years, 6 months ago
Hi all! I'm now developing my first real game, thought I would need some good advices. It's a tetris game, I've got some ideas, but I really need some help from you people over here. My ideas... are they good? How to improve them?

// Clockwise rotation (up -> right -> down -> left -> up ...)
enum direction = { up, right, down, left };
uint Field[50][20];  // Our playfiled

class Block {
public:
    void RotateBlock();             // Theese are here to show
    void MoveBlock(KeyboardInput);  // how i'm thinking

private:
    bool moving;
    direction Direction;

    // Array that the block will be stored in.
    // The biggest block is the straight 4-block,
    // To rotate it, do it have to be 4x4 blocks large.
    // 1 = block
    // 0 = space
    // Ex.
    // 0100  Will draw a straight 4-blocks long block
    // 0100
    // 0100
    // 0100
    ushort type[4][4]; 

    ushort itsXpos;
    ushort itsYpos;
};
  
This might be a bad model, and its really simplified, but what I wanted to show is the type-array. Is it good to restore the rotated object in that matrix? I thought of looping through the type-array for every frame and check the position with the field to make a collision detect. Isn't that slow? Do you know any better ways? please help me!! This is my first real game (or project at all!)!! No way! I will never write a profile signature! EDIT: The post and the code looked ugly! [edited by - the Chef on October 5, 2002 11:18:19 AM]
No way! I will never write a profile signature! :p
Advertisement
It''s how I did it as well. 4x4 matrix that holds the block, if you rotate the block, rotate it into a new 4x4 matrix, then copy the new matrix over the old.

Collision detection is pretty darn fast this way. Certainly if your game field is also a matrix.
Thanks for the reply! Maby I underestinated (hope I spelled it right ) myself... hehe

Now I''ll go just into the codeing... or make a real nice homepage for my coming projects...
No way! I will never write a profile signature! :p

This topic is closed to new replies.

Advertisement