I Wanna Community

Fangames => Game Design => Programming Questions => Topic started by: RebornIsaac on August 13, 2015, 05:59:32 PM

Title: Autofire Item Help
Post by: RebornIsaac on August 13, 2015, 05:59:32 PM
Hello everyone!
So, I am making a fangame (Kill The Gecko) and I already made some stuff, anyways, I wanted to know how could I make an Autofire item? I already have all the globals needed, now I only need to know how to make it Autofire once you get the Item and escape the room, any help?

In advance, thanks!
Title: Re: Autofire Item Help
Post by: lawatson on August 13, 2015, 06:29:26 PM
if global.item_enabled==1{
if keyboard_check(ord('Z')){
playerShoot();
}
}

Put it in the player's step event code, maybe in the last part. Replace global.item_enabled with whatever you use to keep track of whether autofire is enabled.
Title: Re: Autofire Item Help
Post by: RebornIsaac on August 13, 2015, 07:28:11 PM
if global.item_enabled==1{
if keyboard_check(ord('Z')){
playerShoot();
}
}

Put it in the player's step event code, maybe in the last part. Replace global.item_enabled with whatever you use to keep track of whether autofire is enabled.

I tried it, but I get this error:
ERROR in
action number 1
of  Step Event
for object player:

Error in code at line 113:
   if (global.button4=(ord="Z")) {
                           ^
at position 26: Cannot compare arguments.

What I did (There are two control modes, ShiftZ and ZX):

if (global.item1==1){
if (global.button4=(ord="Z")) {
if (keyboard_check(ord="Z")){
playerShoot();
} } }
if (global.item1==1){
if (global.button4=(ord="X")) {
if (keyboard_check(ord="X")){
playerShoot();
} } }

What am I doing wrong?


EDIT: Apparently I didn't correctly follow your code, making it not working, tried again with exactly what you copied and it worked, thanks! <3