Code edit (1 edits merged)
Please save this source code
User prompt
Rocket Runner: Fuel the Journey
Initial prompt
Objective: Create a one-tap endless runner where players guide a rocket through floating platforms, dodging obstacles and collecting fuel orbs to maximize score. Core Mechanics: Controls: Single tap (or click) to make the rocket jump/boost upward. No tap means the rocket falls due to gravity. Platforms: Randomly generated platforms move left at a constant speed. The rocket must land on them to avoid falling. Fuel Orbs: Collectible orbs appear above platforms, granting points when collected. Obstacles: Optionally add moving obstacles (e.g., comets) in later iterations for challenge. Scoring: 10 points per fuel orb; score increases as the player survives longer. Game Over: Rocket falls below the screen, triggering a restart option on tap. Visual Style: Theme: Retro-futuristic with a vibrant, starry background (#1a1a3d) and quirky rocket designs (e.g., cartoonish rockets with expressive faces). Assets: Simple 2D sprites for rocket (50x50px), platforms (100x20px), and fuel orbs (20x20px). Use Uplit’s sprite management for smooth rendering. Animations: Add subtle rocket tilt on jump and particle effects (via Uplit’s particle system) for orb collection and crashes. Uplit Implementation: Setup: Use Uplit’s Game class to initialize a 800x600 canvas with a dark background. Physics: Leverage Uplit’s lightweight physics for gravity (0.5) and jump force (-12). Use createSprite for rocket, platforms, and orbs. Random Generation: Spawn platforms at random y-positions (within 100-400px from bottom) every 200px along x-axis. Add 50% chance for fuel orbs. Collisions: Use game.collides to detect rocket-platform landings and rocket-orb collections. Input: Use onTouchStart for tap/click to trigger jumps or restart on game over. Performance: Uplit’s sprite culling ensures off-screen objects (platforms/orbs) are removed efficiently. Features: Random Levels: Platforms spawn with varied y-positions for endless variety. Rocket Designs: Unlockable skins (e.g., red rocket, UFO) via score milestones (not implemented in base code but extensible). Leaderboards: Use Uplit’s cloud integration (if available) to store high scores, or local storage for simplicity. Polish: Add sound effects for jumps (beep) and orb collection (sparkle) using Uplit’s audio system. Player Experience: Appeal: Quick, addictive sessions (1-2 minutes) for casual players. Collectibles and increasing difficulty keep players engaged. Difficulty Curve: Start with wider platforms, gradually increase moveSpeed or reduce platform size as score grows. Feedback: Visual feedback (orb sparkle, rocket shake on landing) and score display enhance satisfaction. Development Tips: Prototype Fast: Use Uplit’s hot-reload to tweak gravity, jump force, and platform spacing in real-time. Optimize: Keep sprite counts low (max 10 platforms/orbs) to ensure smooth performance on mobile. Test Inputs: Test tap responsiveness on touch devices to ensure precise jumps. Asset Creation: Create simple PNGs in tools like Aseprite for rocket, platforms, and orbs, or use placeholder shapes in Uplit for prototyping. Next Steps: Add obstacles (e.g., moving comets) with createSprite and collision checks. Implement rocket skins by swapping image property on score thresholds. Add a title screen with game.drawText and state management for start/restart.
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
}); /****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});