{"id":22551329,"url":"https://github.com/joelumbley/platformer-with-level-editor","last_synced_at":"2026-01-06T18:32:39.932Z","repository":{"id":190460018,"uuid":"682673493","full_name":"JoeLumbley/Platformer-with-Level-Editor","owner":"JoeLumbley","description":"An Invaluable Resource for Learning Game Development","archived":false,"fork":false,"pushed_at":"2024-04-13T21:34:21.000Z","size":5530,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-14T10:58:42.694Z","etag":null,"topics":["game","level-editor","platformer-2d-game","platformer-game","vb-net","xbox-controller"],"latest_commit_sha":null,"homepage":"","language":"Visual Basic .NET","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JoeLumbley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-08-24T17:18:31.000Z","updated_at":"2024-04-15T13:29:24.854Z","dependencies_parsed_at":"2023-12-03T09:29:56.576Z","dependency_job_id":"f998b6ca-7f94-4dd9-bcd5-cdcfa59f8546","html_url":"https://github.com/JoeLumbley/Platformer-with-Level-Editor","commit_stats":null,"previous_names":["joelumbley/platformer-with-level-editor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoeLumbley%2FPlatformer-with-Level-Editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoeLumbley%2FPlatformer-with-Level-Editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoeLumbley%2FPlatformer-with-Level-Editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoeLumbley%2FPlatformer-with-Level-Editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoeLumbley","download_url":"https://codeload.github.com/JoeLumbley/Platformer-with-Level-Editor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246009076,"owners_count":20708881,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game","level-editor","platformer-2d-game","platformer-game","vb-net","xbox-controller"],"created_at":"2024-12-07T17:12:13.064Z","updated_at":"2026-01-06T18:32:34.884Z","avatar_url":"https://github.com/JoeLumbley.png","language":"Visual Basic .NET","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Make Your Own Games**\n\n\n If you've ever wanted to dive into game development, **Platformer with Level Editor** is your ticket. This tool is perfect for those looking to roll up their sleeves and get hands-on with creating games.\n\n![163](https://github.com/user-attachments/assets/0d73e214-4b16-49c9-a7ec-be1896427bca)\n\n\n\nThe key things you can expect to explore with this learning tool are:\n\n### **Game Mechanics**\nGet the lowdown on how games tick. We’re talking physics (how things move), collision detection (when stuff bumps into each other), character controls, and the all-important game loop that keeps everything running.\n\n### **Programming Patterns**\nGame dev isn’t just about coding; it’s about organizing your code. You’ll learn how to structure your programming and handle events so your game reacts to player moves like jumping or shooting.\n\n![167](https://github.com/user-attachments/assets/5788aacc-5b04-4862-bb88-281d99df3e58)\n\n\n\n### **Level Design**\nThe level editor is your playground. Learn to whip up engaging levels, manage them like a pro, and make sure they load smoothly during gameplay. Good level design can make or break the player experience.\n\n\n![166](https://github.com/user-attachments/assets/7a263e93-d8a8-49f9-a6d6-49108dea7c9f)\n\n\n\n### **Sound Integration**\nSounds matter! You’ll figure out how to bring in sound effects and music to amp up the fun—think catchy jump sounds and epic battle tunes.\n\n### **Xbox Controller Support**\nMany gamers use controllers, so you’ll learn how to integrate Xbox controller support to make your game feel just right for console players.\n\n\nRemember, “Platformer with Level Editor” isn’t just about theory—it’s hands-on learning. Dive in, experiment, and let your creativity flow! 🎮✨\n\n\n\n\n\n\n![152](https://github.com/JoeLumbley/Platformer-with-Level-Editor/assets/77564255/a2c5b26f-9b93-4a48-a898-5c7df788ed37)\n\n\n# Code Walkthrough\n**\"Platformer with Level Editor\"** is a game application that allows users to create and customize their own platformer levels. The application includes various tools and features to help players design, edit, and play through their custom levels.\n\n### **Imports and Class Declaration**\n\nWe start by bringing in libraries that give our game extra functionality and setting up the main class for our app.\n\n```vb\nImports System.ComponentModel\nImports System.Drawing.Drawing2D\nImports System.IO\nImports System.Numerics\nImports System.Runtime.InteropServices\nImports System.Text\nImports System.Threading\n\nPublic Class Form1\n```\n\n- **Imports**: These lines bring in useful libraries that provide extra functionality. For example, `System.IO` helps with file operations, and `System.Drawing` is used for graphics.\n\n- **Public Class Form1**: This declares a class named `Form1`. In VB.NET, a class is like a blueprint for creating objects. Here, `Form1` represents the main window of the application.\n\n### **DLL Imports for Audio and Controller**\n\n```vb\n\u003cDllImport(\"winmm.dll\", EntryPoint:=\"mciSendStringW\")\u003e\nPrivate Shared Function mciSendStringW(\u003cMarshalAs(UnmanagedType.LPTStr)\u003e ByVal lpszCommand As String, \u003cMarshalAs(UnmanagedType.LPWStr)\u003e ByVal lpszReturnString As StringBuilder, ByVal cchReturn As UInteger, ByVal hwndCallback As IntPtr) As Integer\nEnd Function\n```\n\n- **DllImport**: This is used to call functions from external libraries (DLLs). Here, it allows the program to play audio files.\n\n- **Function mciSendStringW**: This function sends commands to the multimedia control interface (MCI) for audio playback.\n\n### **Game State Management**\n\nWe define different game states—like starting, playing, and editing—and manage them smoothly.\n\n```vb\nPrivate Enum AppState As Integer\n    Start\n    Playing\n    Editing\n    Clear\nEnd Enum\n```\n\n- **Enum**: An enumeration (enum) is a way to define a group of related constants. Here, `AppState` defines different states the game can be in: starting, playing, editing, and clear.\n\n### **Variables for Game Objects**\n\n```vb\nPrivate Hero As GameObject\nPrivate Cash() As GameObject\nPrivate Blocks() As GameObject\n```\n\n- **Variables**: These are used to store data. `Hero` is a single game object representing the player. `Cash` and `Blocks` are arrays that can hold multiple game objects (like bills or blocks).\n\n### **Game Initialization**\n\n```vb\nPrivate Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load\n    InitializeApp()\nEnd Sub\n```\n\n- **Form1_Load**: This is an event that runs when the form (window) loads. It calls `InitializeApp()` to set up the game.\n\n### **Initializing the Game**\n\nWhen your app loads, you’ll set up everything from sound files to game objects.\n\n```vb\nPrivate Sub InitializeApp()\n    CreateSoundFilesFromResources()\n    InitializeObjects()\n    InitializeForm()\nEnd Sub\n```\n\n- **InitializeApp**: This method sets up the game by creating sound files, initializing game objects, and setting up the form's appearance.\n\n### **Creating Sounds**\n\n```vb\nPrivate Sub CreateSoundFilesFromResources()\n    Dim File As String = Path.Combine(Application.StartupPath, \"level.mp3\")\n    CreateSoundFileFromResource(File, My.Resources.level)\nEnd Sub\n```\n\n- **CreateSoundFilesFromResources**: This method creates sound files from resources included in the project. It uses the `CreateSoundFileFromResource` method to save the sound file.\n\n### **Game Loop**\n\nThis is where the magic happens. The loop updates the game state and refreshes the screen like clockwork.\n\n```vb\nPrivate Sub GameTimer_Tick(sender As Object, e As EventArgs) Handles GameTimer.Tick\n    UpdateFrame()\n    Refresh()\nEnd Sub\n```\n\n- **GameTimer_Tick**: This event runs repeatedly at set intervals (like a clock tick ⏰). It updates the game state and redraws the window.\n\n### **Updating the Frame**\n\n```vb\nPrivate Sub UpdateFrame()\n    Select Case GameState\n        Case AppState.Start\n            ' Logic for starting state\n        Case AppState.Playing\n            ' Logic for playing state\n        Case AppState.Editing\n            ' Logic for editing state\n    End Select\nEnd Sub\n```\n\n- **UpdateFrame**: This method checks the current game state and runs the appropriate logic based on whether the game is starting, playing, or in editing mode.\n\n### **User Input Handling**\n\n You’ll learn to handle keyboard inputs and make sure your game objects interact the way you want.\n\n```vb\nPrivate Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown\n    Select Case e.KeyCode\n        Case Keys.E\n            DoEKeyDownLogic()\n        Case Keys.P\n            DoPKeyDownLogic()\n    End Select\nEnd Sub\n```\n\n- **Form1_KeyDown**: This event handles keyboard input. When a key is pressed, it checks which key and calls the corresponding method to handle that input.\n\n### **Game Object Interaction**\n\n```vb\nPrivate Sub DrawOurHero()\n    With Buffer.Graphics\n        If Hero.Rect.IntersectsWith(Camera.Rect) Then\n            ' Draw hero logic here\n        End If\n    End With\nEnd Sub\n```\n\n- **DrawOurHero**: This method draws the hero on the screen. It checks if the hero is within the camera's view before drawing it.\n\n### **Ending the Game**\n\n```vb\nPrivate Sub Form1_Closing(sender As Object, e As CancelEventArgs) Handles MyBase.Closing\n    CloseSounds()\nEnd Sub\n```\n\n- **Form1_Closing**: This event runs when the user closes the application. It calls `CloseSounds()` to stop any playing sounds.\n\n\n\nThis code is a basic structure of a platformer game with a level editor. Each part of the code works together to create a playable game where users can design their own levels. \n\n\n\n\n\n\n\n\n\n\n\n# Controller Code Walkthrough\n\nLet's break down the steps involved in using controllers in the game code. This includes detecting the controller, reading its state, and responding to input.\n\n### **Importing Necessary Libraries**\n\nBefore you can use controllers, you need to import the necessary libraries:\n\n```vb\nImports System.Runtime.InteropServices\n```\n\n- This allows you to use functions from external libraries (like the XInput library) that handle controller inputs.\n\n### **Declaring DLL Imports**\n\nYou need to declare functions from the XInput library that will help you interact with the controller:\n\n```vb\n\u003cDllImport(\"XInput1_4.dll\")\u003e\nPrivate Shared Function XInputGetState(dwUserIndex As Integer, ByRef pState As XINPUT_STATE) As Integer\nEnd Function\n```\n\n- **XInputGetState**: This function checks the state of the controller (e.g., whether it's connected and the status of buttons and sticks).\n\n### **Defining Structures for Controller State**\n\nYou need to define structures that represent the state of the controller:\n\n```vb\n\u003cStructLayout(LayoutKind.Explicit)\u003e\nPublic Structure XINPUT_STATE\n    \u003cFieldOffset(0)\u003e Public dwPacketNumber As UInteger\n    \u003cFieldOffset(4)\u003e Public Gamepad As XINPUT_GAMEPAD\nEnd Structure\n\n\u003cStructLayout(LayoutKind.Sequential)\u003e\nPublic Structure XINPUT_GAMEPAD\n    Public wButtons As UShort\n    Public bLeftTrigger As Byte\n    Public bRightTrigger As Byte\n    Public sThumbLX As Short\n    Public sThumbLY As Short\n    Public sThumbRX As Short\n    Public sThumbRY As Short\nEnd Structure\n```\n\n- **XINPUT_STATE**: Contains the packet number and the gamepad state.\n- **XINPUT_GAMEPAD**: Contains button states and thumbstick positions.\n\n### **Checking if the Controller is Connected**\n\nYou need a method to check if the controller is connected:\n\n```vb\nPrivate Function IsControllerConnected(controllerNumber As Integer) As Boolean\n    Return XInputGetState(controllerNumber, ControllerPosition) = 0\nEnd Function\n```\n\n- This function returns `True` if the controller is connected (indicated by a return value of 0).\n\n### **Updating Controller State**\n\nYou need to update the controller state regularly, typically in the game loop:\n\n```vb\nPrivate Sub UpdateControllerData()\n    For ControllerNumber As Integer = 0 To 3\n        Try\n            If IsControllerConnected(ControllerNumber) Then\n                UpdateControllerState(ControllerNumber)\n            End If\n        Catch ex As Exception\n            DisplayError(ex)\n        End Try\n    Next\nEnd Sub\n```\n\n- This loop checks each controller (up to 4) and updates its state if connected.\n\n### **Reading Button States**\n\nInside the `UpdateControllerState` method, you will read the button states:\n\n```vb\nPrivate Sub UpdateControllerState(controllerNumber As Integer)\n    If Connected(0) AndAlso controllerNumber = 0 Then\n        ' Use controller zero\n        UpdateButtonPosition()\n        ' Other updates for thumbsticks, triggers, etc.\n    End If\nEnd Sub\n```\n\n- You can check specific buttons by using bitwise operations on `wButtons`:\n\n```vb\nIf (Gamepad.wButtons And AButton) \u003c\u003e 0 Then\n    ' A button is pressed\nEnd If\n```\n\n### **Handling Input Actions**\n\nYou will typically have methods to handle specific input actions based on button presses:\n\n```vb\nPrivate Sub DoAKeyDownLogic()\n    ' Logic for when the A button is pressed\nEnd Sub\n```\n\n### **Vibrating the Controller**\n\nYou can also make the controller vibrate based on game events:\n\n```vb\n\u003cDllImport(\"XInput1_4.dll\")\u003e\nPrivate Shared Function XInputSetState(playerIndex As Integer, ByRef vibration As XINPUT_VIBRATION) As Integer\nEnd Function\n\nPublic Structure XINPUT_VIBRATION\n    Public wLeftMotorSpeed As UShort\n    Public wRightMotorSpeed As UShort\nEnd Structure\n```\n\n- You can set the motor speeds to create a vibration effect.\n\n### **Integrating with Game Logic**\n\nFinally, you integrate the controller input into the game logic, allowing players to control the hero, navigate menus, and interact with the game world using the controller.\n\n### Summary\n\nUsing controllers in your game involves:\n1. Importing necessary libraries.\n2. Declaring external functions to communicate with the controller.\n3. Defining structures to hold controller state information.\n4. Checking if the controller is connected.\n5. Regularly updating the controller state in the game loop.\n6. Reading button states and handling input actions.\n7. Optionally, implementing vibration feedback.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Getting Started\n\nHere are some steps you can take to learn game development using the \"Platformer with Level Editor\" project:\n\n\n### **Set Up Your Environment**\n\nVisual Studio is an Integrated Development Environment (IDE) created by Microsoft. \n\nIt is a powerful software development tool that provides a comprehensive set of features and tools for building a wide range of applications.\n\nThis is the IDE I use to make \"Platformer with Level Editor\" and I recommend that you use.\n\nGrab Visual Studio Community—it's free and perfect for indie devs.\n\nInstall Visual Studio from here:  https://visualstudio.microsoft.com/downloads/ and include the .NET Desktop Development workload.\n\n![153](https://github.com/JoeLumbley/Platformer-with-Level-Editor/assets/77564255/22a61c77-908f-4e04-9266-93f3d34ec376)\n\n\n### **Clone the Repository** \n\nFollow the steps to get your local copy of the project.\n\n1. Click the \"Code\" button.\n2. Copy the repository's URL.\n3. Open Visual Studio.\n4. Click \"Clone a repository\".\n5. Paste the repository URL into the location field.\n6. Click the \"Clone\" button.\n\nOnce the cloning process is complete, you will have your own local copy of the game that you can run and modify on your computer.\n\n\nWatch a short about cloning the repository here: https://www.youtube.com/shorts/n8bCEIdI44U\n\n![154](https://github.com/JoeLumbley/Platformer-with-Level-Editor/assets/77564255/a937ec81-c192-4dff-b4b0-badd87c07f87)\n\n\n### **Explore and Modify:**\n\nGet familiar with the project structure and start adding your own flair.\n\n### **Use Resources**\n\nDon’t forget to check out the documentation and tutorials to level up your skills.\n\n\n![072](https://github.com/JoeLumbley/Platformer-with-Level-Editor/assets/77564255/c4ae4c4c-7641-4a9f-96d5-c19805fdcc01)\n\n\n### **Seek Community Feedback**\n\nEngage with the project’s community for feedback and learning opportunities.\n\nBy following these steps, you’ll gain hands-on experience, learn programming patterns, and build skills in creating interactive games! 🎮🚀\n\n\n\n\n\n\n\n\n\n\n\n\n# **Why GDI+**\n\n### **Easy to Learn**\n\nGDI+ offers a user-friendly interface that makes it perfect for beginners. Its straightforward methods for drawing shapes, text, and images are intuitive, allowing you to quickly grasp the basics of programming.\n\n### **Minimal Setup**\n\nForget complicated configurations! GDI+ requires minimal setup, enabling you to dive straight into coding and focus on learning essential programming concepts without distractions.\n\n### **Integration with .NET**\n\nSince GDI+ is part of the .NET framework, you're likely already familiar with it from your coursework. This integration means you can build on your existing knowledge and use the tools you already know.\n\n### **Rich Language Support**\n\nWhether you prefer C# or VB.NET, GDI+ supports multiple programming languages, making it versatile for different learning styles.\n\n### **Immediate Visual Feedback**\n\nOne of the best features of GDI+ is the real-time visual results. You can see the impact of your code instantly, helping you understand and retain concepts better. Drawing graphics allows you to visualize important programming ideas like loops, conditionals, and events.\n\n### **Interactive Learning**\n\nWith GDI+, you can create interactive applications, such as simple games or simulations. This fosters creativity and keeps you engaged in your learning process.\n\n### **Focus on Core Concepts**\n\nGDI+ helps you build foundational programming skills, including object-oriented programming, event-driven design, and algorithmic thinking, all without the complexity of advanced graphics programming.\n\n### **Real-World Problem Solving**\n\nUsing GDI+, you can tackle practical challenges like game design or data visualization, reinforcing your problem-solving abilities.\n\n### **Cross-Platform Potential**\n\nWhile GDI+ is primarily used in Windows environments, it serves as a great stepping stone to more advanced graphics libraries like OpenGL or DirectX as you progress.\n\n### **Web Integration**\n\nYou can also explore how GDI+ integrates with web applications through ASP.NET, broadening your skill set and understanding of web development.\n\n### **Community and Resources**\n\nThere’s a wealth of tutorials, documentation, and community support available for GDI+. This makes it easy for you to find the resources you need to succeed.\n\n### **Project Examples**\n\nTeachers can easily create engaging projects using GDI+, allowing you to apply what you learn in real-world scenarios.\n\nGDI+ strikes a perfect balance between functionality and accessibility. Its simplicity lets you focus on learning programming fundamentals while providing enough depth for creative exploration, laying a solid foundation for your future studies in computer science and software development.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n![063](https://github.com/JoeLumbley/Platformer-with-Level-Editor/assets/77564255/c55ed39f-9a4e-43d6-84a0-f5c364f224d9)\n\n\n\n\n\n![178](https://github.com/user-attachments/assets/28913edb-fb04-4f1e-9832-421f6d60457b)\n\n\n\n\n\n![176](https://github.com/user-attachments/assets/00c53141-a430-47a7-b096-33c249621094)\n\n\n![177](https://github.com/user-attachments/assets/e3199597-c7ef-4809-9515-2575cf701c95)\n\n\n\n\n\n\n![169](https://github.com/user-attachments/assets/e423b338-cb9c-430c-8d31-9c67eb08f12c)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoelumbley%2Fplatformer-with-level-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoelumbley%2Fplatformer-with-level-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoelumbley%2Fplatformer-with-level-editor/lists"}