Hi guy!... If You're one of the few people that come to this blog, you know for sure that it's been quite some time since the last post. I had a lot to do in the past couple of years. Almost 2 years already. Time flies by so fast! I got my Bachelor's degree. Currently, i'm pursing a Master's degree in Information System Management. But since i wanted to come back, i wanted to relearn myself all that i had forgotten. This Tutorial i'm about to give to you is how i relearned things step by step after so long. With AI these days, people sometimes think that they can do work more faster, but they don't work at all. They AI is making the work for them. And while trying to relearn things, i was tempted to use AI to go faster. But getting code from AI makes you dumber than you think when you are a beginner and don't have solid foundation. So this blog is dedicated to the creation of games using JavaScript. One of the best tools you could use in JavaScript to m...
To make the ball's movement feel more natural and less stiff, we will improve its interaction with the platforms based on their inclination. This will give the game a more realistic feel, where the ball responds to slopes and angles. 1. Modify Ball Movement Based on Platform Rotation The ball's speed and direction should be influenced by the platform’s rotation, so that it rolls naturally down slopes. We will adjust the velocity of the ball using some basic physics. Here’s the key logic: Check the angle of the platform. Apply a force on the ball that matches the slope's direction. In JavaScript (assuming you're using Three.js or a similar engine): javascript function updateBallPhysics ( ball, platforms ) { platforms. forEach ( platform => { // Check if the ball is on the platform if ( isBallOnPlatform (ball, platform)) { // Get the platform's rotation let rotationAngle = platform. rotation . z ; // Adjust based on axis // Cal...