Hi there! in this new video tutorial I'm going to show you
how to implement a camera rotation effect in Game Maker Studio
how to implement a camera rotation effect in Game Maker Studio
first
I am going to show you the project I will be using for this tutorial
I am going to show you the project I will be using for this tutorial
I am going to show you the project I will be using for this tutorial
is just a simple platform game
you can use your own platform games
as you can see is nothing really special
now, let's get back to the project
well
the first thing we need is to create an object
the first thing we need is to create an object
the first thing we need is to create an object
create object
name this object
objRotationHandler
okay
now we are going to add an event
let's add a 'Create' event
in this 'Create' Event let's add the 'Execute Code' action
in this 'Create' Event let's add the 'Execute Code' action
in this 'Create' Event let's add the 'Execute Code' action
in this 'Create' Event let's add the 'Execute Code' action
in this 'Create' Event let's add the 'Execute Code' action
inside this action I'm going to create
inside this action I'm going to create
inside this action I'm going to create
a variable 'Angle'
a variable 'Angle'
here we are going to store the angle value
here we are going to store the angle value
now let's add a 'Step' event
now let's add a 'Step' event
now let's add a 'Step' event
inside this 'Step' event let's add an 'Execute Code' action
inside this 'Step' event let's add an 'Execute Code' action
and here I'm going to explain you what I'm trying to do
and here I'm going to explain you what I'm trying to do
and here I'm going to explain you what I'm trying to do
I want to make the following:
if I press the multiply key I want to increase the angle by one
if I press the multiply key I want to increase the angle by one
if I press the multiply key I want to increase the angle by one
and if I press the divide key I want to decrease the angle variable by one
and if I press the divide key I want to decrease the angle variable by one
and if I press the divide key I want to decrease the angle variable by one
and if I press the divide key I want to decrease the angle variable by one
and if I press the divide key I want to decrease the angle variable by one
so, let's implement it
so, let's implement it
(autocompletation is not working very fast)
if I press the multiply key
if I press the multiply key
if I press the multiply key
I want to increase the angle by one
this line of code increases the angle by one
this line of code increases the angle by one
if I press the divide key I'm going to decrease the angle variable by one
if I press the divide key I'm going to decrease the angle variable by one
if I press the divide key I'm going to decrease the angle variable by one
if I press the divide key I'm going to decrease the angle variable by one
okay
now I have to set this angle value to the current view
now I have to set this angle value to the current view
now I have to set this angle value to the current view
now I have to set this angle value to the current view
and we do this with the following line:
and we do this with the following line:
just remember in Game Maker the default view is zero view
the view number zero
the view number zero
the view number zero
now let's assign the angle variable
and...
...this this is all the code you need
as you can see really, really simple
as you can see really, really simple
the object is created
the object is created
and now the only thing remaining is to add this object in your room
and now the only thing remaining is to add this object in your room
and now the only thing remaining is to add this object in your room
and now the only thing remaining is to add this object in your room
and now the only thing remaining is to add this object in your room
in my case I have the room...
in my case I have the room...
in my case I have the room...
I always like to add the objects without sprites in the top-left corner
I always like to add the objects without sprites in the top-left corner
I always like to add the objects without sprites in the top-left corner
I always like to add the objects without sprites in the top-left corner
I always like to add the objects without sprites in the top-left corner
I always like to add the objects without sprites in the top-left corner
let's add it
click the 'Ok' button
and now it refreshes the object
this is a little bit annoying but.. well...
okay
let's add the object to the room
uh... it's done, as you can see this is or objRotationHandler
uh... it's done, as you can see this is our 'objRotationHandler'
okay, let's test it!
okay, let's test it!
okay... is taking a while
okay... is taking a while
and here we are
now I'm going to press the multiply key
now I'm going to press the multiply key
now I'm going to press the multiply key
and as expected the angle increases
and as expected the angle increases
and if I press the divide key the angle decreases
and if I press the divide key the angle decreases
and if I press the divide key the angle decreases
the angle value is stored in degrees
in the views
the angle value is stored in degrees
you can use radians
Game Maker Studio has some built-in conversion functions
Game Maker Studio has some built-in conversion functions
in order to work with radians and degrees
in order to work with radians and degrees
you can use them too
but by default using degrees... it will be okay
but by default using degrees... it will be okay
but by default using degrees... it will be okay
but by default using degrees... it will be okay
so... well...
that's it
hope you find this video useful
see you