-
February 12th, 2016, 01:05 PM
#1
Simple platform game,player doesnt move properly on the block.
I have made a simple platfrom game, when i made a simple block on screen, the character had proper movements around, but when i add some background and a little more in game, the character doesn't move properly when it is on the block and it keep in viberating.
following is the code for a block.
#region Block1
/////1. side collision
if (player.Right > Block1.Left && player.Left < Block1.Right - player.Width && player.Bottom<Block1.Bottom && player.Bottom > Block1.Top)
right = false;
if (player.Left < Block1.Right && player.Right > Block1.Left + player.Width && player.Bottom < Block1.Bottom && player.Bottom > Block1.Top)
left = false;
/////2. top collisions
if (player.Left + player.Width > Block1.Left && player.Left + player.Width < Block1.Left + Block1.Width + player.Width && player.Top + player.Height >= Block1.Top && player.Top < Block1.Top)
{
jump = false;
force = 0;
player.Top = Block1.Location.Y - player.Height;
}
///3. head collisions
if (player.Left + player.Width > Block1.Left && player.Left + player.Width < Block1.Left + Block1.Width + player.Width && player.Top-Block1.Bottom<=10 && player.Top-Block1.Top>-10)
{
force = -1;
}
#endregion
-
February 12th, 2016, 06:38 PM
#2
Re: Simple platform game,player doesnt move properly on the block.
Why don't you add some Debug.WriteLine statements to try to figure out where things are going wrong?
-
February 19th, 2016, 04:01 PM
#3
Re: Simple platform game,player doesnt move properly on the block.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|