{"id":730,"date":"2013-12-01T18:41:26","date_gmt":"2013-12-01T17:41:26","guid":{"rendered":"http:\/\/labalec.fr\/erwan\/?p=730"},"modified":"2013-12-01T18:41:54","modified_gmt":"2013-12-01T17:41:54","slug":"vb-net-and-xna-article-19-a-platform-game-with-fpe-3-5","status":"publish","type":"post","link":"https:\/\/labalec.fr\/erwan\/?p=730","title":{"rendered":"VB.Net and XNA : Article 19 &#8211; A platform game with FPE 3.5"},"content":{"rendered":"<p>XNA and FPE is nice to play with.<\/p>\n<p>This time lets start a platform game : an animated character jumping from one platform to another, collecting gems, in a wold of physics.<\/p>\n<p>Some interesting point to note :<\/p>\n<p>1-when my character is walking on tiles, the engine detects a collision at each edge, blocking my character \ud83d\ude41<br \/>\nmad googling around, it seems i should :<br \/>\n-use joints : does not work<br \/>\n-use shapes : did not test it yet<br \/>\n-use multiple fixture for one bigger body : did not test it yet<\/p>\n<p>For now, i create a circle for each tile instead of rectangles, it does mitigate (a lot) that bug : it is mostly invisible to the human eye (we see only the texture remember, not a body).<\/p>\n<p>2-We want the character to jump only when touching the top of the tile, not the sides (or bottom).<br \/>\nAlso, we dont want the character to jump while in the air.<br \/>\nThere I have applied what seems the most common trick : a feet sensor, an extra body (not drawn) joined to my character (below) thru JointFactory.CreateWeldJoint.<br \/>\nWhen \u00ab\u00a0feet\u00a0\u00bb will collide with \u00ab\u00a0floor\u00a0\u00bb then isjumping=false else isjumping=true<\/p>\n<p>3-The scenery is automatically generated from a text file (= a level) : <a href=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2013\/12\/level1.txt\">level<\/a> .<br \/>\nA level editor could come later.<\/p>\n<p>As a whole, this is far from being perfect yet : the user\/gamer experience is not optimal yet but still, I believe it is a good start \ud83d\ude42<\/p>\n<p>The video.<\/p>\n<div style=\"width: 695px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-730-1\" width=\"695\" height=\"493\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2013\/12\/XNA_platform.mp4?_=1\" \/><a href=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2013\/12\/XNA_platform.mp4\">https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2013\/12\/XNA_platform.mp4<\/a><\/video><\/div>\n<p>The source code.<\/p>\n<p><a href=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2013\/12\/XNA_DEMO_22.zip\">XNA_DEMO_22<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>XNA and FPE is nice to play with. This time lets start a platform game : an animated character jumping from one platform to another, collecting gems, in a wold of physics. Some interesting point to note : 1-when my character is walking on tiles, the engine detects a collision at each edge, blocking my <a href='https:\/\/labalec.fr\/erwan\/?p=730' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,35],"tags":[],"class_list":["post-730","post","type-post","status-publish","format-standard","hentry","category-dotnet","category-xna","category-34-id","category-35-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/730","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=730"}],"version-history":[{"count":1,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/730\/revisions"}],"predecessor-version":[{"id":735,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/730\/revisions\/735"}],"wp:attachment":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}