Creating a Simple Drag-and-Drop Game in Godot 2D for Android

Dipak Telang - Oct 2 - - Dev Community

As part of an assignment, I developed a simple yet interactive Godot 2D project for the Android platform in landscape mode. The project features a drag-and-drop mechanic where players can customize a character with different items, such as hats, shirts, pants, and shoes. Here's a breakdown of the process and the features:
Key Features:

Drag-and-Drop Mechanic: The main gameplay involves dragging a hat from a tool panel and placing it on the character's head. This interaction is intuitive, allowing the player to pick up and move the hat by dragging it with their finger.

Snap to Position: If the hat is dropped near the character's head, it snaps into place, making the interaction feel natural and rewarding for the user.

Return to Panel: If the player drops the hat anywhere other than the designated area on the character, the hat smoothly returns to the tool panel, encouraging the player to try again. This feature helps to maintain user-friendly gameplay flow.

Optional Customization: In addition to the hat, I implemented other draggable items, such as shirts, pants, and shoes, allowing for a full character customization experience.
Enter fullscreen mode Exit fullscreen mode

Image description

Development Process:

The project was created using Godot Engine and designed specifically for Android devices in landscape mode. Key aspects of the development included:

Creating a Panel for Items: The drag-and-drop items (hat, shirts, pants, and shoes) were placed on a panel for easy access by the player.

Snap Behavior: I used collision shapes and area detection to check if the hat is dropped close enough to the character's head. When it is, the hat smoothly snaps to the correct position.

Drag Control: Touch input was implemented to allow smooth dragging and dropping of the items across the screen.
Enter fullscreen mode Exit fullscreen mode

Deliverables:

APK and Project File: I exported the project as an APK file for Android and included the entire project folder with all necessary resources and scripts.
Screen-Recorded Gameplay Video: I also created a screen-recorded video showcasing the gameplay and the different interactive elements of the game, which highlights the drag-and-drop mechanic in action.
Enter fullscreen mode Exit fullscreen mode

Links:

  1. APK
  2. Project File
  3. Screen-Recorded Gameplay Video

This project was a fun way to explore basic UI interactions and touch input controls in Godot while creating a simple customization game for mobile platforms.

. .
Terabox Video Player