Moving... pretty much required in games right? Well the first tutorial I showed you you needed 8 different events. Well after watching a few youtube videos I found one that had tought me how to move with only 1-2 event(s). The step event has finally proved itself to me. This tutorial requires coding, but you could just copy & paste if you aren't fast at typing which I'm not. Alright lets get started.
STEPS (no pun intended)
1.)You need 2 objects, Obj_guy(player. I like to call it obj_guy because it's shorter) and an obj_land.
2.)obj_land = solid
3.)Under obj_guy make a step event. Execute code.
Type this
if place_free(x,y+.5){gravity = 0.5} //gravity
else{gravity = 0} gravity_direction = 270
if vspeed > 10 {vspeed = 10} //limit speed
if keyboard_check(vk_up) && !place_free(x,y+.5) {vspeed -= 10} //move controls
if keyboard_check(vk_left) && place_free(x-5,y){x-=5}
if keyboard_check(vk_right) && place_free(x+5,y){x+=5}
Okay so the first 2 lines,(before "//limit speed") this is setting the gravity. so if there is no object below you in .5 pixels to set the gravity to 0.5(kinda real life gravity). 2nd line: if there is any thing below you in .5 pixels to set the gravity to 0(no gravity) The gravity_direction = 270 part is just telling the gravity to go downwards.
if vspeed > 10 {vspeed = 10} This is just setting a speed falling limit so your character doesn't go like 300,000 mph down a hole and break through the ground (it's possible, trust me).
Okay lets start with going right.
the first part, if keyboard_check(vk_right) this is telling gamemaker to see if the right arrow key is pressed then do the following actions and if not pressed, then stop. In gamemaker, when you want to add or tie something together, you use 2 & signs. the second part, && place_free(x+5,y){x+=5} this part has the place_free command also. This time it asking if there is anything 5 pixels to the right then move right 5 pixels. Also if you didn't know adding the + or - sign next to the = sign makes it relative. It's Pretty close to the opposite direction just change the + signs to minus and of course add vk_left.
The jumping is also close. the first part is the same. the && signs. something that is different is the ! sign. This won't work without the ! sign!
(x,y+.5) {vspeed -= 10} the first part of this is asking if there's anything below you in .5 pixels, if so vspeed -=10(jumping).
Now that was only the 1st event, the second event is collision with obj_land.
1.) execute code:
if vspeed >= 0 && !place_free(x,y+vspeed) {move_contact(270)} vspeed=0
Okay this code is a little confusing, I still don't know 100% of it.
If vspeed >= 0 and if there is a place free under you while jumping then go downwards(270) and vspeed = 0.
Well that's about it, You should compare this moving with my old moving. much less crowded. Hope you learned something and if you did, tell your friends or anyone that plays gamemaker. I also have a sandbox.yoyogames.com account named pop12601. I put up some games I'm working on and some old games I found. Thanks for reading. Bye!
Happy gaming!
Gamemaker Help
A blog to help the beginners of the program gamemaker
Which type of Game maker do you use?
Monday, June 9, 2014
Friday, June 6, 2014
Events,Events,And More Events
Hello!
I'm bored so I wanna write a post. This post: Events!
So I'm assuming this will be a long post so lets start now.
1.) Create
This event is instantly that object appears. close to the room start event.
ex.) hp = 100
2.)Destroy
This event does the actions right before the object is destroyed, so it still exists then after the actions it's destroyed.
ex.) score =+ 2
3.)Alarm
Alarms are used for timing. there is an action needed for this event called " set alarm "(you set the alarm then steps. In gamemaker 30 steps is one second). Basically you could put set alarm 0 for 30 seconds in the create event, then after one second the actions under alarm 0 will happen.
ex.) Timer; get to the end by a certain amount of time.
4.)step
The step event happens constantly. To be more precise, I think it's about 1/30th of a second, i think I read that somewhere. The begin and end step are rarely needed but begin step happen before the normal step and end step happen after the normal step
ex.)make the object look at the mouse
5.)Collision
this event happens whenever this object collides with another object.
ex.) obj_player collides with obj_wall will cause speed = 0
6.)keyboard
this is very similar to the key press event, to be honest, I never found a difference.
ex.)Moving
7.)Mouse
This is probably one of the most useful events. It includes left button pressed, left button, left release same with right, and more.
ex.)shooting to the mouse
8.) other
outside room- when the object goes out of the screen
intersect boundary- the object collides with the boundary of the room
views- boundary's & outside of views
game start- as soon as the game starts
game end- as soon as the game ends
room start & room end- happens when the room starts + ends
no more lives- gamemaker has a built in life system and this happens when lives equal 0
no more health- gamemaker also has a built in health system and this activates when health = 0
animation end- all sprites that have images have animation, and once that animation is done this event activates
end of path- this event works only with objects that have paths and once that path is done, this activates
close button- the close button the X in the corner of the window that you click to end the game
user defined- events when you decide and not gamemaker
9.)draw- this event is used to draw or show sprites,backgrounds, and whatever is under the draw tab
ex.)showing how much health is left
10.)key pressed- this event occurs whenever the button is pressed
ex.)start to move
11.)key release-this event occurs whenever the button is released
ex.)stop moving
12.)triggers- this event is only in standard and i still have lite, so i have no idea what it does. My guess is that it's kinda like an alarm.
Well that's all of 'em. well that took a long time. So I hope you learned something about this post and you can carry you knowledge to someone else. Good luck.
Happy Gaming
I'm bored so I wanna write a post. This post: Events!
So I'm assuming this will be a long post so lets start now.
1.) Create
This event is instantly that object appears. close to the room start event.
ex.) hp = 100
2.)Destroy
This event does the actions right before the object is destroyed, so it still exists then after the actions it's destroyed.
ex.) score =+ 2
3.)Alarm
Alarms are used for timing. there is an action needed for this event called " set alarm "(you set the alarm then steps. In gamemaker 30 steps is one second). Basically you could put set alarm 0 for 30 seconds in the create event, then after one second the actions under alarm 0 will happen.
ex.) Timer; get to the end by a certain amount of time.
4.)step
The step event happens constantly. To be more precise, I think it's about 1/30th of a second, i think I read that somewhere. The begin and end step are rarely needed but begin step happen before the normal step and end step happen after the normal step
ex.)make the object look at the mouse
5.)Collision
this event happens whenever this object collides with another object.
ex.) obj_player collides with obj_wall will cause speed = 0
6.)keyboard
this is very similar to the key press event, to be honest, I never found a difference.
ex.)Moving
7.)Mouse
This is probably one of the most useful events. It includes left button pressed, left button, left release same with right, and more.
ex.)shooting to the mouse
8.) other
outside room- when the object goes out of the screen
intersect boundary- the object collides with the boundary of the room
views- boundary's & outside of views
game start- as soon as the game starts
game end- as soon as the game ends
room start & room end- happens when the room starts + ends
no more lives- gamemaker has a built in life system and this happens when lives equal 0
no more health- gamemaker also has a built in health system and this activates when health = 0
animation end- all sprites that have images have animation, and once that animation is done this event activates
end of path- this event works only with objects that have paths and once that path is done, this activates
close button- the close button the X in the corner of the window that you click to end the game
user defined- events when you decide and not gamemaker
9.)draw- this event is used to draw or show sprites,backgrounds, and whatever is under the draw tab
ex.)showing how much health is left
10.)key pressed- this event occurs whenever the button is pressed
ex.)start to move
11.)key release-this event occurs whenever the button is released
ex.)stop moving
12.)triggers- this event is only in standard and i still have lite, so i have no idea what it does. My guess is that it's kinda like an alarm.
Well that's all of 'em. well that took a long time. So I hope you learned something about this post and you can carry you knowledge to someone else. Good luck.
Happy Gaming
More About Sprites!
'ello fellow gamers!
So I was reading my blog because I was bored and I realized I didn't tell much about sprites in gamemaker.
So hear I am.
1.) The transform button
This button shows at the top of the screen next to edit. The transform button allows you to rotate, flip, skew, shift, and more. They do exactly as they sound.
2.) The images button
Right after the transform button, it allows to cycle in multiple ways, change the value & intensity, "colorize"(change the color) and more cool effects if you have standard version
3.) the animation button
The button located after images, the animation button allows the computer to rotate or shift or colorize automatically, so its easier on you.
4.)Masks
Masks are the space on the object to collide with other objects. ex.) you have a square sprite and you set the mask to be the whole square. this would be perfect because if it collides with a wall, it'll stop as soon it touches the mask(the square in this example). However if you had a square and only made the center the mask, the square will keep going until the center hits the wall.
4A.) masks:Bounding box
after you click "modify mask under your sprite you'll come across a screen that has your sprite and kinda darkened. the darkened part is the mask. there are ways to change this and there a sub heading that says "bounding Box" that has "automatic"(automatically puts the mask in the sprite), "full image"(no matter how big the image is this option will make the mask in full size), and "manual"(you make the mask).
4B.)masks: shape
instead of bounding box, there is another sub heading called "shape". I rarely use this one but I'll need to explain it sometime. So there is 4 options under shape, "precise"( this make the mask perfect), "rectangle"(makes the mask a rectangle), "disk"(disk is another word for circle), and "diamond"( I never found a use for diamond, but it does what it sounds like, makes the mask diamond)
5.)save sprite
This button is found under Load sprite and above edit sprite. What this button does is save your sprite if you made or edited one. ex.) You go to edit sprite and you make an amazing sprite of a top down shooter, you probably don't want to make it again and spend another hour on it. so you can click save sprite and it'll go under the folder of your choice and you can use it whenever.
6.)Origin
the origin of the sprite is the center. the origin comes in handy when you make the sprite rotate and shoot with accuracy.
That's about all I know about sprites. If i learn more I'll edit this post and tell ya fellow gamers more.
Good luck with gamemaker.
Happy gaming!
So I was reading my blog because I was bored and I realized I didn't tell much about sprites in gamemaker.
So hear I am.
1.) The transform button
This button shows at the top of the screen next to edit. The transform button allows you to rotate, flip, skew, shift, and more. They do exactly as they sound.
2.) The images button
Right after the transform button, it allows to cycle in multiple ways, change the value & intensity, "colorize"(change the color) and more cool effects if you have standard version
3.) the animation button
The button located after images, the animation button allows the computer to rotate or shift or colorize automatically, so its easier on you.
4.)Masks
Masks are the space on the object to collide with other objects. ex.) you have a square sprite and you set the mask to be the whole square. this would be perfect because if it collides with a wall, it'll stop as soon it touches the mask(the square in this example). However if you had a square and only made the center the mask, the square will keep going until the center hits the wall.
4A.) masks:Bounding box
after you click "modify mask under your sprite you'll come across a screen that has your sprite and kinda darkened. the darkened part is the mask. there are ways to change this and there a sub heading that says "bounding Box" that has "automatic"(automatically puts the mask in the sprite), "full image"(no matter how big the image is this option will make the mask in full size), and "manual"(you make the mask).
4B.)masks: shape
instead of bounding box, there is another sub heading called "shape". I rarely use this one but I'll need to explain it sometime. So there is 4 options under shape, "precise"( this make the mask perfect), "rectangle"(makes the mask a rectangle), "disk"(disk is another word for circle), and "diamond"( I never found a use for diamond, but it does what it sounds like, makes the mask diamond)
5.)save sprite
This button is found under Load sprite and above edit sprite. What this button does is save your sprite if you made or edited one. ex.) You go to edit sprite and you make an amazing sprite of a top down shooter, you probably don't want to make it again and spend another hour on it. so you can click save sprite and it'll go under the folder of your choice and you can use it whenever.
6.)Origin
the origin of the sprite is the center. the origin comes in handy when you make the sprite rotate and shoot with accuracy.
That's about all I know about sprites. If i learn more I'll edit this post and tell ya fellow gamers more.
Good luck with gamemaker.
Happy gaming!
Saturday, March 15, 2014
How To Jump
Hi gamers! Jumping is almost required in all arcade games right? And gamemaker is great for making arcade games! So i figured I should make a tutorial about jumping.(in steps)
1.)make two sprites the obj_guy & obj_land
2.) under obj_guy choose the create event: Set gravity
gravity : .5
direction : 270
2A.)the last action for this event is a variable: Set variable
variable: jump
value : 0
3.)the second event is "press (jump button)"
test variable:
if var jump is equal to 0
Start of block
set vertical speed to -10
Set var jump to 1
End of block
if var jump is equal to 1
Start of block
exit this event
end of block
should look like that.
4.) now the last event is collision with the obj_land
set vertical speed to 0
set var jump to 0
That's what you need to know about jumping. I'm sure thereare multiple other ways, but this is the easiest i've seen by far.
Hope you enjoyed this post and
Happy Gaming!
1.)make two sprites the obj_guy & obj_land
2.) under obj_guy choose the create event: Set gravity
gravity : .5
direction : 270
2A.)the last action for this event is a variable: Set variable
variable: jump
value : 0
3.)the second event is "press (jump button)"
test variable:
if var jump is equal to 0
Start of block
set vertical speed to -10
Set var jump to 1
End of block
if var jump is equal to 1
Start of block
exit this event
end of block
should look like that.
4.) now the last event is collision with the obj_land
set vertical speed to 0
set var jump to 0
That's what you need to know about jumping. I'm sure thereare multiple other ways, but this is the easiest i've seen by far.
Hope you enjoyed this post and
Happy Gaming!
How To Shoot Toward The Mouse
Hello friendly game maker fellows! I was making a game a bit ago where you use w,a,s,d to move and the mouse to shoot. Then i thought "Hey, I should put a tutorial on how to shoot the mouse." And here I am.
Alright so the first thing you want to do is make 2 sprites, obj_guy & obj_bullet.
Now go to the obj_guy and select the event Global left pressed. (mouse->Global mouse->Global left pressed)
once you've done that go to execute code (under controls tab) Don't stop reading because there is coding it is at most 5 lines.
Type in:
with instance_create(x,y,obj_bullet)
{
speed=20
direction=point_direction(x, y, mouse_x, mouse_y)
}
This code is saying to create instance of obj_bullet with the speed of 20 and the direction is where mouse was clicked.
That's how to shoot toward the mouse.
Another thing you might want in to make your character look at the mouse. this requires coding but only 1 line.
So under obj_guy click the step event.
Then click execute code.
Type:
image_angle = point_direction(x,y,mouse_x,mouse_y);
This is telling gamemaker to make obj_guy follow the direction of the x and y of the mouse.
That's all you need required to make multiple other types of games.
Thanks for reading.
Happy Gaming!
Alright so the first thing you want to do is make 2 sprites, obj_guy & obj_bullet.
Now go to the obj_guy and select the event Global left pressed. (mouse->Global mouse->Global left pressed)
once you've done that go to execute code (under controls tab) Don't stop reading because there is coding it is at most 5 lines.
Type in:
with instance_create(x,y,obj_bullet)
{
speed=20
direction=point_direction(x, y, mouse_x, mouse_y)
}
This code is saying to create instance of obj_bullet with the speed of 20 and the direction is where mouse was clicked.
That's how to shoot toward the mouse.
Another thing you might want in to make your character look at the mouse. this requires coding but only 1 line.
So under obj_guy click the step event.
Then click execute code.
Type:
image_angle = point_direction(x,y,mouse_x,mouse_y);
This is telling gamemaker to make obj_guy follow the direction of the x and y of the mouse.
That's all you need required to make multiple other types of games.
Thanks for reading.
Happy Gaming!
Subscribe to:
Comments (Atom)