K
koirapoika74
Guest
So I've tried to implement an ammo system in my game but all the guns seem to hold the same values instead of holding their own. How would I accomplish this?
In oGunPickup Object
there is a code that gives the gun its ammo depending on whitch sprite it has.
if image_index=0 ammo=6
if image_index=1 ammo=14
if image_index=2 ammo=4
And in oPlayer object
if (mouse_check_button_pressed(mb_right)) {
if place_meeting(x,y,oGunPickup) && oGunPickup.ammo > 0{
ammo = oGunPickup.ammo}
// Throw old gun
with (instance_create(x, y, oGunPickup)) {
image_index = oldGun;
with oGunPickup{
ammo = oPlayer.ammo}
direction = point_direction(other.x, other.y, mouse_x, mouse_y);
speed = 14;
In oGunPickup Object
there is a code that gives the gun its ammo depending on whitch sprite it has.
if image_index=0 ammo=6
if image_index=1 ammo=14
if image_index=2 ammo=4
And in oPlayer object
if (mouse_check_button_pressed(mb_right)) {
if place_meeting(x,y,oGunPickup) && oGunPickup.ammo > 0{
ammo = oGunPickup.ammo}
// Throw old gun
with (instance_create(x, y, oGunPickup)) {
image_index = oldGun;
with oGunPickup{
ammo = oPlayer.ammo}
direction = point_direction(other.x, other.y, mouse_x, mouse_y);
speed = 14;
Last edited by a moderator: