undisclosed updates
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
db1e11ea17331e53dc5b54044b57cf0f6ba97399- Parents
-
054467b - Tree
cc20753
db1e11e
db1e11ea17331e53dc5b54044b57cf0f6ba97399054467b
cc20753| Status | File | + | - |
|---|---|---|---|
| M |
js/entities.js
|
311 | 233 |
| M |
js/game.js
|
53 | 12 |
js/entities.jsmodified@@ -968,6 +968,12 @@ class Obstacle { | |||
| 968 | this.bobSpeed = random(0.02, 0.04) | 968 | this.bobSpeed = random(0.02, 0.04) |
| 969 | this.bobAmount = 0 | 969 | this.bobAmount = 0 |
| 970 | 970 | ||
| 971 | + // Wind effect properties | ||
| 972 | + this.windSway = 0 // Current sway amount | ||
| 973 | + this.windSwayTarget = 0 // Target sway for smooth animation | ||
| 974 | + this.windBob = 0 // Additional vertical movement from wind | ||
| 975 | + this.basketSwing = 0 // For balloon basket swinging | ||
| 976 | + | ||
| 971 | // Type-specific initialization | 977 | // Type-specific initialization |
| 972 | if (this.type === 'balloon') { | 978 | if (this.type === 'balloon') { |
| 973 | this.bobAmount = 8 // Balloons bob more | 979 | this.bobAmount = 8 // Balloons bob more |
@@ -1006,6 +1012,57 @@ class Obstacle { | |||
| 1006 | let bob = sin(frameCount * this.bobSpeed + this.bobOffset) * this.bobAmount | 1012 | let bob = sin(frameCount * this.bobSpeed + this.bobOffset) * this.bobAmount |
| 1007 | this.y = this.originalY + bob | 1013 | this.y = this.originalY + bob |
| 1008 | 1014 | ||
| 1015 | + // ENHANCED: Apply wind effects | ||
| 1016 | + if (windActive) { | ||
| 1017 | + // Different wind responses by type | ||
| 1018 | + if (this.type === 'balloon') { | ||
| 1019 | + // Balloons are highly affected by wind | ||
| 1020 | + this.windSwayTarget = cos(windDirection) * windStrength * 15 // Strong horizontal push | ||
| 1021 | + this.windBob = | ||
| 1022 | + sin(frameCount * 0.04 + this.bobOffset) * windStrength * 3 // Extra vertical movement | ||
| 1023 | + | ||
| 1024 | + // Basket swings opposite to balloon movement (pendulum effect) | ||
| 1025 | + this.basketSwing = | ||
| 1026 | + -this.windSway * 0.5 + sin(frameCount * 0.06) * windStrength * 0.3 | ||
| 1027 | + | ||
| 1028 | + // Actually move the balloon | ||
| 1029 | + this.originalX += cos(windDirection) * windStrength * 0.08 | ||
| 1030 | + | ||
| 1031 | + // Keep on screen with stronger resistance at edges | ||
| 1032 | + if (this.originalX < 50) { | ||
| 1033 | + this.originalX = 50 | ||
| 1034 | + this.windSwayTarget *= -0.5 // Bounce back effect | ||
| 1035 | + } | ||
| 1036 | + if (this.originalX > width - 50) { | ||
| 1037 | + this.originalX = width - 50 | ||
| 1038 | + this.windSwayTarget *= -0.5 | ||
| 1039 | + } | ||
| 1040 | + } else if (this.type === 'beetle') { | ||
| 1041 | + // Beetles resist but still affected | ||
| 1042 | + this.windSwayTarget = cos(windDirection) * windStrength * 3 | ||
| 1043 | + // Fight against wind | ||
| 1044 | + this.driftAngle -= cos(windDirection) * windStrength * 0.01 | ||
| 1045 | + } else if (this.type === 'leaf') { | ||
| 1046 | + // Leaves flutter in wind | ||
| 1047 | + this.windSwayTarget = cos(windDirection) * windStrength * 5 | ||
| 1048 | + this.rotation += windStrength * 0.02 // Spin faster | ||
| 1049 | + } | ||
| 1050 | + } else { | ||
| 1051 | + // No wind, return to normal | ||
| 1052 | + this.windSwayTarget = 0 | ||
| 1053 | + this.windBob = 0 | ||
| 1054 | + this.basketSwing = 0 | ||
| 1055 | + } | ||
| 1056 | + | ||
| 1057 | + // Smooth sway animation | ||
| 1058 | + this.windSway = lerp(this.windSway, this.windSwayTarget, 0.1) | ||
| 1059 | + | ||
| 1060 | + // Apply wind sway to position | ||
| 1061 | + this.x = this.originalX + this.windSway | ||
| 1062 | + | ||
| 1063 | + // Apply wind bob to vertical position | ||
| 1064 | + this.y = this.originalY + bob + this.windBob | ||
| 1065 | + | ||
| 1009 | // Beetle-specific drift | 1066 | // Beetle-specific drift |
| 1010 | if (this.type === 'beetle') { | 1067 | if (this.type === 'beetle') { |
| 1011 | // Store initial position if not set | 1068 | // Store initial position if not set |
@@ -1210,6 +1267,11 @@ class Obstacle { | |||
| 1210 | // ============================================ | 1267 | // ============================================ |
| 1211 | push() | 1268 | push() |
| 1212 | 1269 | ||
| 1270 | + // ENHANCED: Tilt balloon based on wind | ||
| 1271 | + if (windActive) { | ||
| 1272 | + rotate(this.windSway * 0.01) // Slight tilt in wind direction | ||
| 1273 | + } | ||
| 1274 | + | ||
| 1213 | // Balloon shadow | 1275 | // Balloon shadow |
| 1214 | noStroke() | 1276 | noStroke() |
| 1215 | fill(0, 0, 0, 30) | 1277 | fill(0, 0, 0, 30) |
@@ -1370,10 +1432,15 @@ class Obstacle { | |||
| 1370 | 1432 | ||
| 1371 | pop() | 1433 | pop() |
| 1372 | 1434 | ||
| 1373 | - // BIGGER, MORE DETAILED BASKET | 1435 | + // BIGGER, MORE DETAILED BASKET WITH SWING |
| 1374 | push() | 1436 | push() |
| 1375 | translate(0, this.radius + 25) | 1437 | translate(0, this.radius + 25) |
| 1376 | 1438 | ||
| 1439 | + // ENHANCED: Apply basket swing | ||
| 1440 | + if (windActive) { | ||
| 1441 | + rotate(this.basketSwing * 0.02) | ||
| 1442 | + } | ||
| 1443 | + | ||
| 1377 | // Basket shadow | 1444 | // Basket shadow |
| 1378 | noStroke() | 1445 | noStroke() |
| 1379 | fill(0, 0, 0, 20) | 1446 | fill(0, 0, 0, 20) |
@@ -1414,6 +1481,11 @@ class Obstacle { | |||
| 1414 | push() | 1481 | push() |
| 1415 | translate(0, this.radius + 28) | 1482 | translate(0, this.radius + 28) |
| 1416 | 1483 | ||
| 1484 | + // ENHANCED: Ant holds on tighter in wind | ||
| 1485 | + if (windActive) { | ||
| 1486 | + rotate(-this.basketSwing * 0.01) // Ant leans opposite to basket | ||
| 1487 | + } | ||
| 1488 | + | ||
| 1417 | // Ant body | 1489 | // Ant body |
| 1418 | fill(20) | 1490 | fill(20) |
| 1419 | noStroke() | 1491 | noStroke() |
@@ -1454,6 +1526,12 @@ class Obstacle { | |||
| 1454 | // Sandbags hanging from basket (optional detail) | 1526 | // Sandbags hanging from basket (optional detail) |
| 1455 | push() | 1527 | push() |
| 1456 | translate(0, this.radius + 25) | 1528 | translate(0, this.radius + 25) |
| 1529 | + | ||
| 1530 | + // ENHANCED: Sandbags swing in wind | ||
| 1531 | + if (windActive) { | ||
| 1532 | + rotate(this.basketSwing * 0.03) | ||
| 1533 | + } | ||
| 1534 | + | ||
| 1457 | fill(80, 60, 40) | 1535 | fill(80, 60, 40) |
| 1458 | noStroke() | 1536 | noStroke() |
| 1459 | ellipse(-12, 10, 4, 5) | 1537 | ellipse(-12, 10, 4, 5) |
js/game.jsmodified@@ -879,30 +879,65 @@ function draw () { | |||
| 879 | 879 | ||
| 880 | // PHASE 4B: Apply wind to airborne entities | 880 | // PHASE 4B: Apply wind to airborne entities |
| 881 | if (windActive) { | 881 | if (windActive) { |
| 882 | - // Push spider if airborne | 882 | + // Push spider if airborne - MORE DRAMATIC |
| 883 | if (spider.isAirborne) { | 883 | if (spider.isAirborne) { |
| 884 | - spider.vel.x += cos(windDirection) * windStrength * 0.1 | 884 | + spider.vel.x += cos(windDirection) * windStrength * 0.15 // Increased from 0.1 |
| 885 | + spider.vel.y += sin(frameCount * 0.05) * windStrength * 0.03 // Add vertical wobble | ||
| 885 | } | 886 | } |
| 886 | 887 | ||
| 887 | - // Push flies | 888 | + // Push flies - MORE VISIBLE |
| 888 | for (let fly of flies) { | 889 | for (let fly of flies) { |
| 889 | if (!fly.stuck && !fly.caught) { | 890 | if (!fly.stuck && !fly.caught) { |
| 890 | - fly.vel.x += cos(windDirection) * windStrength * 0.05 | 891 | + fly.vel.x += cos(windDirection) * windStrength * 0.08 // Increased from 0.05 |
| 892 | + fly.vel.y += sin(frameCount * 0.1 + fly.wingPhase) * windStrength * 0.02 // Turbulence | ||
| 891 | } | 893 | } |
| 892 | } | 894 | } |
| 893 | 895 | ||
| 894 | - // Make webs sway | 896 | + // ENHANCED: Make webs sway and stretch |
| 895 | for (let strand of webStrands) { | 897 | for (let strand of webStrands) { |
| 896 | if (!strand.broken) { | 898 | if (!strand.broken) { |
| 897 | - strand.vibrate(windStrength * 0.5) | 899 | + // Stronger vibration |
| 900 | + strand.vibrate(windStrength * 0.8) // Increased from 0.5 | ||
| 901 | + | ||
| 902 | + // Apply lateral force to web path points for realistic sway | ||
| 903 | + if (strand.path && strand.path.length > 2) { | ||
| 904 | + for (let i = 1; i < strand.path.length - 1; i++) { | ||
| 905 | + let point = strand.path[i] | ||
| 906 | + // Middle points sway more than ends | ||
| 907 | + let swayFactor = sin((i / strand.path.length) * PI) | ||
| 908 | + point.x += cos(windDirection) * windStrength * swayFactor * 0.3 | ||
| 909 | + // Add some vertical movement too | ||
| 910 | + point.y += | ||
| 911 | + sin(frameCount * 0.08 + i * 0.1) * | ||
| 912 | + windStrength * | ||
| 913 | + swayFactor * | ||
| 914 | + 0.15 | ||
| 915 | + } | ||
| 916 | + } | ||
| 917 | + | ||
| 898 | // Check if strand is overstretched and should break | 918 | // Check if strand is overstretched and should break |
| 899 | - if (strand.tension > 1.2 && windStrength > 3) { | 919 | + if (strand.tension > 1.0 && windStrength > 4) { |
| 900 | - if (random() < 0.01) { | 920 | + // Lowered from 1.2 |
| 901 | - // Small chance per frame | 921 | + if (random() < (0.02 * windStrength) / 5) { |
| 922 | + // Increased chance based on wind strength | ||
| 902 | strand.broken = true | 923 | strand.broken = true |
| 903 | notifications.push( | 924 | notifications.push( |
| 904 | new Notification('Wind snapped a web!', color(255, 150, 100)) | 925 | new Notification('Wind snapped a web!', color(255, 150, 100)) |
| 905 | ) | 926 | ) |
| 927 | + // Add dramatic snap particles | ||
| 928 | + for (let j = 0; j < 8; j++) { | ||
| 929 | + let p = new Particle( | ||
| 930 | + strand.path[Math.floor(strand.path.length / 2)].x, | ||
| 931 | + strand.path[Math.floor(strand.path.length / 2)].y | ||
| 932 | + ) | ||
| 933 | + p.vel = createVector( | ||
| 934 | + cos(windDirection) * random(3, 6), | ||
| 935 | + random(-2, 2) | ||
| 936 | + ) | ||
| 937 | + p.color = color(255, 255, 255) | ||
| 938 | + p.size = random(2, 5) | ||
| 939 | + particles.push(p) | ||
| 940 | + } | ||
| 906 | } | 941 | } |
| 907 | } | 942 | } |
| 908 | } | 943 | } |
@@ -1739,16 +1774,22 @@ function spawnThiefBird () { | |||
| 1739 | function startWindGust () { | 1774 | function startWindGust () { |
| 1740 | windActive = true | 1775 | windActive = true |
| 1741 | windDirection = random() < 0.5 ? 0 : PI // Left or right | 1776 | windDirection = random() < 0.5 ? 0 : PI // Left or right |
| 1742 | - windStrength = random(2, 5) // Variable strength | 1777 | + windStrength = random(3, 6) // Increased from (2, 5) |
| 1743 | windDuration = random(300, 600) // 5-10 seconds | 1778 | windDuration = random(300, 600) // 5-10 seconds |
| 1744 | windTimer = 0 | 1779 | windTimer = 0 |
| 1745 | windParticles = [] | 1780 | windParticles = [] |
| 1746 | 1781 | ||
| 1747 | - // Notification | 1782 | + // More dramatic notification |
| 1748 | let direction = windDirection === 0 ? '→' : '←' | 1783 | let direction = windDirection === 0 ? '→' : '←' |
| 1784 | + let intensity = windStrength > 4.5 ? 'Strong' : windStrength > 3.5 ? 'Moderate' : 'Light' | ||
| 1749 | notifications.push( | 1785 | notifications.push( |
| 1750 | - new Notification(`Wind gust ${direction}`, color(200, 200, 255)) | 1786 | + new Notification(`${intensity} wind gust ${direction}`, color(200, 200, 255)) |
| 1751 | ) | 1787 | ) |
| 1788 | + | ||
| 1789 | + // Screen shake for strong winds | ||
| 1790 | + if (windStrength > 4.5) { | ||
| 1791 | + screenShake = 5 | ||
| 1792 | + } | ||
| 1752 | } | 1793 | } |
| 1753 | 1794 | ||
| 1754 | function updateWind () { | 1795 | function updateWind () { |