TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ahmad Zia
NA
21
656
Simple Platform game, player doesnt move properly on blocks
Feb 12 2016 12:00 PM
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
Reply
Answers (
0
)
Crop the selected color from an image ?
how to display contents of two dimensional dictionary in c#?