GameMaker My first game. A little doubt...

D

DanielKGM

Guest
(First of all I'm sorry if my English is wrong.)
Hello, I started making games about 6 days ago and I decided to start learning with platform games because of a tutorial I saw. Anyway, the game is about a guy who throws pizzas and soda, but the "bullets" of soda are too separate.

I want to know how to make the bullets much stick togheter and give a better soda-being-throw-effect ...

This is the main doubt, if possible I want to know how to make this weapon disable after sometime of button holding and become available again after a "recharge"... THX

please see:
https://imgur.com/a/PN82MLF

orefri = gun object // Oplayer = player object // oBulletR = bullet object

orefri Begin Step code bellow
Code:
x=Oplayer.x;
y=Oplayer.y+13;
image_angle = point_direction(x,y,mouse_x,mouse_y);


 if (mouse_check_button_released(mb_left))
{
instance_activate_object(opizza);
opizza.x=Oplayer.x;
opizza.y=Oplayer.y+13;
}
if (mouse_check_button(mb_left))
{
omaos.visible=0;
with (instance_create_layer(x,y,"Bullet",oBulletR)){
speed= random_range(24,23);
gravity=0.8;
direction= other.image_angle + random_range(-3,3) ;
image_angle=direction;
}
}
if (image_angle>90) and (image_angle<270)
{
image_yscale=-2;
}
else
{
image_yscale=2;
}
x=x-random_range(-2,2);
y=y-random_range(-2,2);
p.s: idk if im posting in the correct place
 
Last edited by a moderator:

NazGhuL

NazTaiL
Hi. One of the simplest solution could be to create more than 1 bubbles at the time.

Code:
repeat(irandom_range(1, 4))
{
with (instance_create_layer(x,y,"Bullet",oBulletR)){
speed= random_range(24,23);
gravity=0.8;
direction= other.image_angle + random_range(-3,3) ;
image_angle=direction;
}
To stop after a certain time, create two variable in the create event:
Code:
//Create event
bubblecounter = 0;
can_shoot = 0;


//step event

if (can_shoot && mouse_check_button(mb_left))
{
bubblecounter++;
//the rest of your code here

     if(bubblecounter >= room_speed*2)
     {
     can_shoot = 0;
     alarm[0] = room_speed;
     }
}

//and on alarm[0] event:
can_shoot = 1;
bubblecounter = 0;
 

TheouAegis

Member
As Naz said, you are already making them as frequently as possible. The issue is your bullets are moving too fast. If you don't want to slow them down, then create two bullets at half the speed apart.

Code:
if (mouse_check_button(mb_left))
{
omaos.visible=0;
with (instance_create_layer(x,y,"Bullet",oBulletR)){
speed= random_range(24,23);
gravity=0.8;
direction= other.image_angle + random_range(-3,3) ;
image_angle=direction;
with (instance_create_layer(x+lengthdir_x(speed/2,direction),y,+lengthdir_y(speed/2,direction),"Bullet",oBulletR)){
speed= random_range(24,23);
gravity=0.8;
direction= other.image_angle + random_range(-3,3) ;
image_angle=direction;
}
}
 
Top