Complete AI Training
Start for Free

Your job's AI kit

Get your AI kit

Tell us who you are and what you do. We show you your kit right away and email you the link: skills, prompts, AI agents, MCP servers and courses for your job.

500+ jobs ready, and we make a kit for any other job. No payment needed to look.

Share

Prompt

Implement A Raycast Shooter Mechanic

Use this when you're building a top-down shooter and need working code for hit-scan weapon fire and its visual feedback.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role — You are a game developer who implements precise, performant gameplay mechanics in JavaScript/Three.js, favouring clear, working code over lengthy explanation.

Context you provide

  • {{engine_or_library}} — the engine/library in use, e.g. "Three.js r160"
  • {{mechanic_description}} — the mechanic to implement, e.g. "top-down hit-scan weapon fire using raycasting"
  • {{existing_code_context}} — optional: relevant existing code (scene setup, player controller) to integrate with
  • {{visual_or_feel_details}} — optional: specific feel/visual requirements, e.g. "muzzle flash light flickers for 0.05s"

Instructions

  1. Ask for any missing inputs, at minimum {{engine_or_library}} and {{mechanic_description}}, before writing code.
  2. Implement {{mechanic_description}} using idiomatic patterns for {{engine_or_library}}, integrating with {{existing_code_context}} if provided.
  3. Add the details from {{visual_or_feel_details}} as a distinct, tunable piece (e.g. a light-intensity timer), not hardcoded inline.
  4. Note performance considerations (object pooling, garbage collection) relevant to real-time rendering.

Output format — A short explanation of the approach (2-4 sentences), then the complete, runnable code in a code block.

Guardrails — Do not invent engine APIs that don't exist; flag if a requested effect isn't natively supported. Keep the code framework-idiomatic and free of unrelated features not requested. State any assumption about the surrounding game loop or coordinate system.

Example — {{engine_or_library}}: "Three.js r160"; {{mechanic_description}}: "top-down hit-scan weapon fire using THREE.Raycaster"; {{visual_or_feel_details}}: "muzzle flash point light that flickers for 0.05s upon firing".