Saturday, April 4, 2015

[Progress] Collision detection with boulder pushing - part 3

My friend introduced me to GifCam, which after double/triple/quadruple checking to make sure this was not the Malware version, works much better for creating animated gifs than using Gyazo (which the previous pictures were captured with). I record it at a lower FPS, to compensate for a much smaller filesize. It saves the dimensions of the recording window too, so all the future recordings will be the same dimensions. It's still going to be choppy, but at least the perfomance of the GIF will remain more accurate than the stuttering found with the Gyazo ones. With that said..

Today is the third day of tackling this problem and I would like to say it is just about perfected. I just removed the collision event between obj_player and obj_pushable_boulder and replicated the player's movement and modified the statements to account for !place_meeting(x,y,collision_controller) instead. Now it behaves just like a player, but also moves at the same speed as the player, thus eliminating the strange "soccer-like" movement. But the best part is, I can remove the comment around my instance_destroy(); code that I had set up for performance boosting again.

if place_meeting(x,y,obj_player) && !place_meeting(x,y,controller_collision) && keyboard_check(ord('D')) {
     if (obj_grid.cells[(x div 16) + 1, y div 16] == 0) {
         isMoving = true; // Lets start moving
         moveTimer = gridSize; // Ready moveTimer for countdown
         speedX = moveSpeed; // Set horizontal speed
         speedY = 0; // Set vertical speed
     }
}

If I'm understanding what I did, I am able to skip out on offsetting the x and y values for the collision because I have already assigned it to a grid value identical to the player as well.

I have not flagged (tagged?) this problem as [Solved] because there still are some issues when it comes to multiple key-presses that causes the boulder to move off the grid (thus messing up all collisions). But for now this will be what I need to finally make some actual progress with the rest of the game.

No comments:

Post a Comment