Game Dev Update

So it’s been three months of working on my game daily. Things have been going pretty well so I thought I’d write an update. I made a pretty big change last week.

Originally the game’s combat would function by rotating the player to always face the cursor. I did this by taking the arctangent of the difference in x and y position of the player and cursor and passing it as orientation in love.graphics.draw.

player.rotation = math.atan2((mouse_y - player.y), (mouse_x - player.x))
function draw.player()
    if player.alive == true then
        love.graphics.draw(player.image,
            player.x,
            player.y,
            player.rotation, --orientation
            1,
            1,
            player.image:getWidth()/2,
            player.image:getHeight()/2
        )
    end
end

I was pretty happy with this at first but it seemed too… simple. Since the player projectiles are shot from the front of the player’s ship, all you had to do was click on the enemy to eliminate them. I’ve made things a bit more challenging.

First, I set love.mouse.setRelativeMode( true ). Basically what this does is it makes the cursor invisible and “relative” to the screen. So instead of the mouse cursor being limited in motion by the dimensions of the screen, the player can move the mouse all over indefinitely without being blocked by the edges of screen. Also the player doesn’t see the mouse cursor while focused on the game.

Then, I did away with that player.rotation calculation above and replaced it with this:

player.rotation = (2 * math.pi * (rotation_y))/window_height

rotation_y comes from the love.mousemoved function which is still called when the mouse is in relative mode even though the cursor position isn’t being updated the regular way.

function love.mousemoved( x, y, dx, dy )
    rotation_y = rotation_y + dy
end

This makes it so the player’s ship rotates whenever the mouse moves up or down. Instead of simply clicking on the enemy with the mouse cursor, the player has to judge the mouse movement based on feedback from the game (the ship’s movement). It’s also much more difficult to judge if the projectile will intercept the intended target or not, much more like a classic twin-stick shooter type of game.

I think this simple change to the design has made the game way more challenging and fun.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s