Author Topic: Help with a boss attack  (Read 2922 times)

LoneTree_tv

  • Wannabe
  • Posts: 32
  • Bad Fangamer and Fangame Dev
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 43.0.2357.134 Chrome 43.0.2357.134
    • View Profile
  • Playstyle: Keyboard
Help with a boss attack
« on: July 23, 2015, 12:29:34 AM »
I'm trying to make that attack where the boss shoots a cherry at you that leaves behind more cherries, and at the end all the cherries shoot off in random directions.
But, I'm doing it an excruciatingly painful way where I assign every cherry a different variable and, at the end, make every cherry variable go in a different direction.
Also, when the spawning cherry goes offscreen, it spawns the cherries at x=0, y=0.
How do I make it like it is in all the other games?

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.89 Chrome 44.0.2403.89
    • View Profile
  • Playstyle: Keyboard
Re: Help with a boss attack
« Reply #1 on: July 23, 2015, 12:50:50 AM »
Make the cherry that follows the player into an object, make the cherries that stay still when spawned into another object, and then when you want them to shoot off, execute the code:

with fruit{
    direction=random(360);
    speed=8;
}

Change fruit to the name of the stand-still fruit that will move, and change speed to whatever fits your liking.

If some of the cherries spawn at 0,0, that means that the cherry that spawned them got deleted. Make sure that it doesn't get deleted when it goes outside the room.
(click to show/hide)

smoke weed everyday

LoneTree_tv

  • Wannabe
  • Posts: 32
  • Bad Fangamer and Fangame Dev
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 43.0.2357.134 Chrome 43.0.2357.134
    • View Profile
  • Playstyle: Keyboard
Re: Help with a boss attack
« Reply #2 on: July 23, 2015, 12:59:21 AM »
Thanks so much!  :atkHappy:
so, just to help me understand in future situations, does "with" make it so it runs the code
for every instance of "fruit"?

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.89 Chrome 44.0.2403.89
    • View Profile
  • Playstyle: Keyboard
Re: Help with a boss attack
« Reply #3 on: July 23, 2015, 03:32:40 AM »
Yes. when you use the with statement, it affects every object and runs the code from their perspective. Another neat thing you can do is address the object running the with statement while within the code itself, like so:
with fruit{
    direction=point_direction(x,y,other.x,other.y);
}
and that'll make its direction actually go towards the object that's running the with statement.
(click to show/hide)

smoke weed everyday

LoneTree_tv

  • Wannabe
  • Posts: 32
  • Bad Fangamer and Fangame Dev
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 44.0.2403.89 Chrome 44.0.2403.89
    • View Profile
  • Playstyle: Keyboard
Re: Help with a boss attack
« Reply #4 on: July 24, 2015, 02:13:43 AM »
Thanks for all the help. I got the attack working, and I started using "with" a lot more.
There's only one problem, my game freezes before I can even load the game data,
it just freezes on the "Loading Game Data ... " window, so all of my progress is gone.  :atkCry: Oh well.

Stepcore

  • Cherry Eater
  • Posts: 87
  • Dreamer of Wizard
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 44.0.2403.89 Chrome 44.0.2403.89
    • View Profile
  • Playstyle: Keyboard
Re: Help with a boss attack
« Reply #5 on: July 24, 2015, 09:06:46 AM »
If you're using Game Maker Studio it makes backups in My Documents\GameMaker\Backups per default afaik.
:PogChamp:

LoneTree_tv

  • Wannabe
  • Posts: 32
  • Bad Fangamer and Fangame Dev
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 44.0.2403.89 Chrome 44.0.2403.89
    • View Profile
  • Playstyle: Keyboard
Re: Help with a boss attack
« Reply #6 on: July 24, 2015, 09:55:20 AM »
Not using studio. But thanks for the help anyway.

Derf

  • Guest
Re: Help with a boss attack
« Reply #7 on: July 24, 2015, 12:03:16 PM »
Do you not have it set to create backups? If you have a .gb1 file (which it should create by default) you can just load that up as a gmk instead.

LoneTree_tv

  • Wannabe
  • Posts: 32
  • Bad Fangamer and Fangame Dev
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 44.0.2403.89 Chrome 44.0.2403.89
    • View Profile
  • Playstyle: Keyboard
Re: Help with a boss attack
« Reply #8 on: July 24, 2015, 12:19:28 PM »
Thank you SOOOO MUCH!!!  :atkLove:
It's just like it was before. And now I can keep working on it.
again, thanks!

LoneTree_tv

  • Wannabe
  • Posts: 32
  • Bad Fangamer and Fangame Dev
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 44.0.2403.89 Chrome 44.0.2403.89
    • View Profile
  • Playstyle: Keyboard
Re: Help with a boss attack
« Reply #9 on: July 24, 2015, 12:20:36 PM »
Also, how often does it create a backup?

klazen108

  • Administrator
  • The Kid
  • Posts: 286
  • your a kid now your a squid now
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 44.0.2403.89 Chrome 44.0.2403.89
    • View Profile
    • Delicious-Fruit
  • Playstyle: Keyboard
Re: Help with a boss attack
« Reply #10 on: July 24, 2015, 12:58:13 PM »
In GM8/8.1, every time you save your file, it copies the old version to a gb1 first.

In GMS, it keeps the last 5 versions in the folder Stepcore mentioned, so even if you accidentally save a corrupted version you're still safe. Make sure to manually backup yourself too at major milestones! Say you finish stage 1 & boss 1, zip that project up and keep it nearby, just in case disaster strikes. It's a good habit to get in to, along with saving in GM often.

Derf

  • Guest
Re: Help with a boss attack
« Reply #11 on: July 24, 2015, 01:52:40 PM »
Woo!

Basically as Klazen said yeah (I'm not sure if the option to create more files staggers their save time though, might be worth googling). But yeah .gb1 files won't always have your back so it's good to do manual backups every once in a while. :~)

LoneTree_tv

  • Wannabe
  • Posts: 32
  • Bad Fangamer and Fangame Dev
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 44.0.2403.89 Chrome 44.0.2403.89
    • View Profile
  • Playstyle: Keyboard
Re: Help with a boss attack
« Reply #12 on: July 24, 2015, 03:18:44 PM »
Alright. Thanks for all the help, to everyone who has replied to me.