Original Post
hi all, I am developing an open source game inspired by Lunar Lander. The issue is that, unlike LL, I want the player to bounce off of the platform. Actually, it bounces once, and then goes through it once the user moves it back towards the platform again. So after the game is initialized (by calling initGame function), the timer takes off and assigns a value for gravity... then we head to the movePlayer function call... What do you see is the problem? I created rectangles with bounds checking for my collision detection. When the rectangles intersect, the player should bounce off of the platform. Once again, it only happens once... so I don't know what's wrong. Any ideas? // this following occurs once every 10 seconds private void timer1_Tick(object sender, EventArgs e) { dy += .1; // account for gravity // call functions to handle the details movePlayer(); //checkPlatform(); setScore(); //moveOrb(); } // Initialize the game private void initGame() { timer1.Enabled = true; } private void movePlayer() { Rectangle rFire = bottomFlame1.Bounds; Rectangle rPlayer = playerBox.Bounds; Rectangle rPlatform = platformBox.Bounds; if (rPlayer.IntersectsWith(rPlatform)) if (Math.Abs(rPlayer.Bottom - rPlatform.Top) < 2) { dy = - dy; } //change x and check for boundaries x += dx; if (x < this.Width - playerBox.Width) { dx = - dy; } if (x < 0) { dx = - dx; } //change y and check for boundaries y += dy; if (y < this.Height - playerBox.Height) { dy = - dy; } if (y < 0) { dy = - dy; } //move picLander to new location playerBox.Location = new Point(Convert.ToInt32(x),Convert.ToInt32(y)); }