Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/694f5245-1110-800b-b182-7c2accd50046
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== 你就把這段貼過去(這包專門救你現在兩個痛點): ==== <syntaxhighlight lang="text">CRITICAL PATCH / Fix broken sprites + bullets not damaging enemies A) Sprite reliability (no more gray fallback surprises) * Embed the player sprite into the HTML as a data URL (base64) OR keep a built-in default sprite. * Do NOT depend on external file paths that can break between runs. * Add F1 debug overlay showing: * playerSprite: LOADED / FAILED * enemySprite: LOADED / FAILED * If sprite failed, draw fallback BUT also display a warning text “USING FALLBACK SPRITE”. B) Collision + damage must work (world-space only) * Ensure BOTH bullets and enemies use the SAME coordinate space: WORLD (x,y). * Bullet update uses world velocity (vx, vy), not screen coords. * Collision check in world space: * Use circle collision for simplicity: dist2(bullet.x, bullet.y, enemy.x, enemy.y) < (bullet.r + enemy.r)^2 * On hit: * enemy.hp -= bullet.damage * spawn hit effect * destroy bullet (or mark inactive) * Ensure enemy.hp is initialized and displayed: * Add small HP bar above enemy. C) Debug visualization (toggle F2) * Draw collision circles: * bullet radius circle * enemy radius circle * Print to console and on-screen when hit occurs: “HIT enemyId=.. dmg=.. hpNow=..” * This is to verify damage logic even if visuals are confusing. Acceptance criteria: * Player sprite loads reliably without needing manual re-upload every time. * Shooting an enemy reduces its HP visibly (HP bar decreases). * Debug mode proves collisions happen in world space. </syntaxhighlight>
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)