Author Topic: Autofire Item Help  (Read 1567 times)

RebornIsaac

  • Cherry Eater
  • Posts: 65
  • ~(´・ω・`)~
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 44.0.2403.130 Chrome 44.0.2403.130
    • View Profile
  • Playstyle: Keyboard
Autofire Item Help
« 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!

lawatson

  • The Kid
  • Posts: 331
  • I do things and I make things.
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 44.0.2403.155 Chrome 44.0.2403.155
    • View Profile
  • Playstyle: Keyboard
Re: Autofire Item Help
« Reply #1 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.
« Last Edit: August 13, 2015, 06:35:33 PM by lawatson »
(click to show/hide)

smoke weed everyday

RebornIsaac

  • Cherry Eater
  • Posts: 65
  • ~(´・ω・`)~
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 44.0.2403.130 Chrome 44.0.2403.130
    • View Profile
  • Playstyle: Keyboard
Re: Autofire Item Help
« Reply #2 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
« Last Edit: August 13, 2015, 08:03:26 PM by RebornIsaac »