Skip to content

Conversation

Copy link

Copilot AI commented Nov 28, 2025

  • Create Sonic The Hedgehog controller script with Sonic 2 physics
  • Change jump button from Space to Shift
  • Add actual Sonic 2 sprites (10073.png sprite sheet)
  • Fix jumping - use input.Press() for reliable jump detection
  • Fix initialization - start Sonic at ground level
  • Add module export for importing into any scene
    • Export SonicModule globally and via return value
    • CreateSonicForPath(path, x, y, includeHUD) helper function
    • SetGroundLevel(y) and SetScreenBounds(w, h, margin) customization
    • Full API documentation in README
  • Update README with comprehensive module usage guide
Original prompt

Create a script that will create playable Sonic The Hedgehog in WickedEngine. It should be accurate to Sonic The Hedgehog 2's physics


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 28, 2025 15:16
Co-authored-by: ExtCan <60326708+ExtCan@users.noreply.github.com>
Co-authored-by: ExtCan <60326708+ExtCan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add playable Sonic The Hedgehog in WickedEngine Add Sonic The Hedgehog controller script with Sonic 2 physics Nov 28, 2025
Copilot AI requested a review from ExtCan November 28, 2025 15:23
@ExtCan
Copy link
Owner

ExtCan commented Nov 28, 2025

@copilot Make the jump button Shift

Co-authored-by: ExtCan <60326708+ExtCan@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 28, 2025

@copilot Make the jump button Shift

Done in 4add42f. Changed the jump button from Space to Shift (both Left and Right Shift are now supported). Updated the script, help text, and README documentation.

@ExtCan
Copy link
Owner

ExtCan commented Nov 28, 2025

Copy link
Author

Copilot AI commented Nov 28, 2025

@copilot Make it use the actual sprites. https://www.spriters-resource.com/media/assets/10/10073.png?updated=1755472454

I'm unable to download files from external domains like spriters-resource.com due to network restrictions in my environment. However, I've updated the script to support sprite sheet animation using WickedEngine's DrawRectAnim feature.

To use the actual Sonic sprites:

  1. Download the sprite sheet from the URL you provided
  2. Save it as Content/scripts/sonic_the_hedgehog/assets/sonic_sprites.png
  3. The script will automatically load and use it for animations

The sprite sheet integration is ready - you just need to add the image file manually.

@ExtCan
Copy link
Owner

ExtCan commented Nov 28, 2025

@copilot Make it use the actual sprites. 10073.png

Copy link
Author

Copilot AI commented Nov 28, 2025

@copilot Make it use the actual sprites. 10073.png

I cannot access external URLs to download the sprite file due to network restrictions. The file 10073.png is not present in the repository.

To add the sprites, please:

  1. Commit the file to Content/scripts/sonic_the_hedgehog/assets/sonic_sprites.png in the repository, or
  2. Push the file to the branch and I'll integrate it

Once the image file is in the repo, I'll update the script to use it for animations.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.spriters-resource.com
    • Triggering command: /usr/bin/curl curl -L -o /home/REDACTED/work/WickedEngine/WickedEngine/Content/scripts/sonic_the_hedgehog/assets/sonic_sprites.png REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@ExtCan
Copy link
Owner

ExtCan commented Nov 28, 2025

@copilot It's in the master branch, how do I bring it to you

Co-authored-by: ExtCan <60326708+ExtCan@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 28, 2025

@copilot It's in the master branch, how do I bring it to you

Done in b55d4ba. I fetched the 10073.png from the master branch and integrated it into the script.

The sprite sheet is now at Content/scripts/sonic_the_hedgehog/assets/sonic_sprites.png and the script uses it for all animations:

  • Idle, walking (8 frames), running (4 frames)
  • Rolling/spin ball (5 frames)
  • Skidding, pushing, looking up, crouching
  • Edge balancing, hurt/dying poses

The sprites use pixel-perfect scaling (QUALITY_NEAREST) for an authentic retro look.

Copilot AI changed the title Add Sonic The Hedgehog controller script with Sonic 2 physics Add Sonic The Hedgehog controller script with Sonic 2 physics and sprites Nov 28, 2025
@ExtCan
Copy link
Owner

ExtCan commented Nov 28, 2025

@copilot Make sure it uses each frame. Also, jumping just doesn't work. Also, make it so I can import it to any scene

Co-authored-by: ExtCan <60326708+ExtCan@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 28, 2025

@copilot Make sure it uses each frame. Also, jumping just doesn't work. Also, make it so I can import it to any scene

Done in a4592be. Fixed all three issues:

  1. Animation frames - Each animation now properly cycles through all defined sprite frames using SpriteFrames table
  2. Jumping fixed - Changed to use input.Press() for reliable jump detection, and fixed initialization to start Sonic at ground level
  3. Importable module - Added SonicModule export that can be imported into any scene:
-- Load and use in your scene
local SonicModule = dofile("Content/scripts/sonic_the_hedgehog/sonic_the_hedgehog.lua")
local sonic, hud = SonicModule.CreateSonicForPath(yourRenderPath, 100, 400, true)

-- In your game loop:
sonic:Update(dt)
sonic:Render(yourRenderPath)

Also added helper functions: SetGroundLevel(y) and SetScreenBounds(width, height, margin) for customization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants