
IF play bounds intersect with the bounds of the platform and out character is not jumping then we change the force integer back to 8 and player will be above the platform. IF X is a type of picturebox AND tag is equals to “platform”
SAMPLE XAMARIN VISUAL STUDIO GAME PROJECT CODE
In this piece of code we will scan the whole form to find the picture boxes with this once our player interacts it will have to land on top of it.įor each control x in this.Controls means for each of the windows component we create a variable called X and give it a type of controls. If we don’t do this then character can fly over everything we need to give the jump a limit.ĮLSE the character is not jumping then we can keep the jump speed on 12. If jumping is true then we change the jump speed integer to minus 12 which means it will thrust the player towards the top and we decrease the force by 1. If go right variable is true then we are going to move the player left towards the right. If go left is true then we can push the character towards left of the screen. This line above is checking if the player is jumping and force of the jump is less than 0 if so then we can change jump back to false. We want it because we want the game to have a gravity effect. Let’s get codingįirst we are starting up with play.Top += jumpSpeed This line we continuosly drop the player towards the floor. We need to do one more thing before we can start coding for this game. Yep lets move on.Ĭhange enabled = TRUE and Interval to 20.Ĭlick on the from and go to the events panel in the properties windowįind the key down – Type keyisdown and press enterįind the key up – Type keyisup and press enterīoth of these actions will take you to the code view.
SAMPLE XAMARIN VISUAL STUDIO GAME PROJECT FULL
This is the player, its full of personality dont you think. Lets add the second picture box to form this time we are going to add the player.Ĭhange the name property to player and back colour to blue. Now you can scale the picture to go across the floor In the properties window change the setting to Size – 500, 650 and Text to Platform Game

Start a new project, Choose windows form application in C# and name it platformgame In the written tutorial we don’t have the moving platforms you see on the video tutorial, but they are easy to implement.Ĭ# Tutorial – Create a simple Platform game in visual studio Note – Written tutorial is slightly different than the video tutorial. Note- There will be some flickering when the character moves and jumps onto the platform, this is caused because of Visual Studio debugging not because of the code, the game will still be working as usual.ĭownload written tutorial platform game images for this project.


