Go Back   ZuneBoards > Zune Discussions > Zune Games > Development Discussions > Development Help

Development Help For help from coding to error finding to that one thing you just can't get right

Reply
 
LinkBack Thread Tools
Old 03-15-2009, 12:09 PM   #1 (permalink)
Experienced Zuner
 
Join Date: Jun 2008
Posts: 123
MercifulBoss is on a distinguished road
Default Aide with Collisions is Requested

I am using StreamReader to read from a .txt file. Then, I use that information for drawing a ground. However, I am having troubles creating Collisions between the ground that is drawn, and my character. Any tips?



MercifulBoss is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old 03-15-2009, 12:20 PM   #2 (permalink)
Jr. Member
 
Join Date: May 2008
Posts: 312
cable729 is on a distinguished road
Default

I'd look at the platformer starter kit.




cable729 is offline   Reply With Quote
Old 03-15-2009, 07:53 PM   #3 (permalink)
Zuner
 
Join Date: Dec 2008
Posts: 91
AndroidAdam is on a distinguished road
Default

How is the terrain drawn in the end? Like is it a single Texture2D or is a bunch of pixels?



AndroidAdam is offline   Reply With Quote
Old 03-17-2009, 09:58 AM   #4 (permalink)
Experienced Zuner
 
Join Date: Jun 2008
Posts: 123
MercifulBoss is on a distinguished road
Default

Quote:
Originally Posted by AndroidAdam View Post
How is the terrain drawn in the end? Like is it a single Texture2D or is a bunch of pixels?

It is drawn as a Texture 2D, that is looped to fullfill the amount of characters in a .txt file.

Also, I have looked at Platformer, and the method employed there, is not compatible with my method.



MercifulBoss is offline   Reply With Quote
Old 03-17-2009, 10:51 AM   #5 (permalink)
Experienced Member
 
Tiptup300's Avatar
 
Join Date: Apr 2008
Posts: 899
Tiptup300 has disabled reputation
Default

snippits would be helpful, you're not giving very much information that could be helpful.



Tiptup300 is offline   Reply With Quote
Old 03-19-2009, 03:19 PM   #6 (permalink)
Experienced Zuner
 
Join Date: Jun 2008
Posts: 123
MercifulBoss is on a distinguished road
Default

Quote:
Originally Posted by Tiptup300 View Post
snippits would be helpful, you're not giving very much information that could be helpful.
Basically this class Draw from the .txt File:

[n.b. itsnotabigtruck: redacted on request of author]

And this is the Collision class:
Code:
        int Rows;
        int Columns;
        int X { get; set; }
        int Y { get; set; }
        Rectangle rec;
        Texture2D CollisionCheck;
        SpriteFont font;
        Vector2 vector = new Vector2(0, 0);

        public int GetIndex(Point pt, Grid grid)
        {
            int row = pt.Y / Grid.CellHeight;
            int col = pt.X / Grid.CellWidth;
            int index = row * grid.Columns + col;
            return index;
        }
        public void CalculateCollisions(Point pt, Grid grid, Sprite sprite)
        {
            for (int i = 0; i < grid.Columns; i++)
            {
                //GetIndex(pt, grid);
                if (grid[GetIndex(pt, grid)] == 1)
                {
                    if (sprite.X > (int)grid.location.X - sprite.Width)
                    {

                    }
                    //sprite.Position.Y = (int)grid.location.Y - Grid.CellHeight * 2 - sprite.Height;
                }
                if (grid[GetIndex(pt, grid)] == 2)
                {
                }
            }
        }
    }

Last edited by itsnotabigtruck; 03-19-2009 at 09:02 PM.



MercifulBoss is offline   Reply With Quote
Old 04-01-2009, 03:10 PM   #7 (permalink)
Jr. Member
 
Join Date: May 2008
Posts: 312
cable729 is on a distinguished road
Default

I'm using bounding boxes. You can look at my code. Visit my thread in development discussions also! Unfair Platformer - Home




cable729 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools