I am using Game Maker 8.1 Lite
Edited by scranner, 03 March 2012 - 10:24 PM.
Posted 03 March 2012 - 10:20 PM
Edited by scranner, 03 March 2012 - 10:24 PM.
Posted 03 March 2012 - 11:04 PM
Posted 03 March 2012 - 11:13 PM
A Breakout type game is fairly simple - it is just a matter of getting the math right so there are no gaps when you place the blocks. Blocks of a uniform size when hit by "something" get destroyed and score awarded.
The space bar firing is not a problem.
Key Event for Space Pressed
Check Instance Number
<select ball object>
Value: 0
<select Equal to>
![]()
Add the fire ball action here
![]()
In essence it means, when the space key is pressed a check is made to see how many balls exist (we only need one) and only if it equals zero do we need to fire one, otherwise we do nothing and pressing space would have had no effect.
The boundary of the game (where the ball cannot go) you fill with wall objects. When the ball collides with these it is bounced off (not precisely so it bounces at angles)![]()
Does that give you enough to get started?
Edited by scranner, 03 March 2012 - 11:14 PM.
Posted 03 March 2012 - 11:22 PM
Posted 04 March 2012 - 12:44 AM
if (keyboard_check(vk_space))
{
if (obj_ball_normal.speed == 0)
{
motion_set(80,12);
}
}
else if (keyboard_check(vk_left))
{
if (obj_ball_normal.speed == 0)
{
obj_ball_normal x -= 1;
}
}
else if (keyboard_check(vk_right))
{
if (obj_ball_normal.speed == 0)
{
obj_ball_normal x += 1;
}
}
if (keyboard_check(vk_space))
{
if (obj_ball_normal.speed != 0) motion_set(0,0);
}
this is the code i am trying at the moment any ideas to why it dosent work. currently the ball just continues to go left to right and so on
Edited by scranner, 04 March 2012 - 01:08 AM.
Posted 04 March 2012 - 01:14 AM
yes could you give me a little more detail please?Give the ball a variable and then in the space event set it to false. Now, while it is true, have a step event that says "if variable is true then x=bat.x and y=bat.y-sprite_height"... or something similar. If you need more precise instructions then let me know!
Posted 04 March 2012 - 01:32 AM
//CREATE EVENT
go=false;
//STEP EVENT
if !go
{
x=bat.x; //change "bat" to the name of your bat object
y=bat.y-sprite_height; //Change sprite_height to the value that makes the ball look correctly positioned on the bat
}
else
{
//normal codes here
}
//KEYBOARD SPACE PRESSED EVENT
with (ball)
{
//Lets make the ball start to move!
if !go
{
go=true; //Set go
speed=6; //Set speed
direction=135-random(90);//Set direction
}
}0 members, 0 guests, 0 anonymous users