Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Beam of War help  (Read 1747 times)

0 Members and 1 Guest are viewing this topic.
Beam of War help
« on: January 30, 2009, 02:40:17 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 245
Okay, so the set-up already works pretty well as-is. Basically right now, if a player's holding a certain button, and has enough energy, it will create an instance of an object in front of them and send it moving. If they hold it, it will just keep making instances, resulting in a continuous beam. An intance of the "beam" is destroyed when it collides with an enemy beam or is outside the bounds of the room.

Right now I have it set up so that when it collides with an opposing beam, it randomly decides which of the 2 to destroy. By modifying the probability, I can make it so one beam is "stronger" than the other, and because it has a greater chance of destroying an opposing instance, it will progress down the length of the other energy beam.


What I want to know is, is there a way to modify the random "chance" via a GML expression? i.e., the chance is one out of "X", X being the answer to the expression, and the chances that the instance ahead will be destroyed.

Because if I just use the drag-and-drop "dice" function, I can only set the value, so one beam is just stronger than the other the whole time. What I WANT to do is have it so the strength of the beam is dependent on the actual strength of the character, and by how quickly you press the space-bar to keep pushing your beam forward.

So does anyone have a simple way to assign the value of "X" (as in, the chances are 1 out of X) using GML expressions?
« Last Edit: January 31, 2009, 01:19:44 am by legendarylugi »
Logged
Re: Beam of War help
« Reply #1 on: January 31, 2009, 12:55:44 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 245
Oh, and I have another question.

What would be a simple way to create a pause menu for things like inventory, etc.?

Would it be something involving views? Or would creating a seperate room for it be a good way?
Logged

Mamoruanime

@Mamoruanime
Re: Beam of War help
« Reply #2 on: January 31, 2009, 08:24:50 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
Oh, and I have another question.

What would be a simple way to create a pause menu for things like inventory, etc.?

Would it be something involving views? Or would creating a seperate room for it be a good way?

I'll answer this one :P

It's better to just halt the objects and display your menu over whatever room you're in IMO. Separate rooms are a bad bad thing for menus :p
Logged
Re: Beam of War help
« Reply #3 on: January 31, 2009, 08:57:43 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 245
^^^So what would be the best way to stop all the objects, but make it so they regain their actions when it's unpaused?
Logged

Mamoruanime

@Mamoruanime
Re: Beam of War help
« Reply #4 on: January 31, 2009, 09:13:41 am »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
^^^So what would be the best way to stop all the objects, but make it so they regain their actions when it's unpaused?

Well, it's as simple as adding a line of code that says "If paused==false" so on so forth.
Logged
Re: Beam of War help
« Reply #5 on: January 31, 2009, 09:25:45 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 245
^^^Thank you very much.  XD

Now I'll just wait for someone to answer my other question.
Logged
Re: Beam of War help
« Reply #6 on: January 31, 2009, 06:50:33 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 245
BTW, this may sound like a noob question, but what does a double equals sign mean? ==?
Logged
Re: Beam of War help
« Reply #7 on: January 31, 2009, 06:56:35 pm »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
A "==" is used for comparison resulting in a boolean return value (e.g. "3 == 4" returns false, "3 == 3" returns true). A "=" is the assignment operator (e.g. "x = 4", you aren't comparing x to 4, you are assigning the value of 4 to x.). Game Maker pretty much doesn't care how you use them, but in things such as C++, it matters a lot.
Logged
Re: Beam of War help
« Reply #8 on: January 31, 2009, 07:06:31 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 245
^^^Ah, I see.

Anyways, for the pause screen, are you guys saying I'd have to stop and restart each object's motion individually?
Logged
Re: Beam of War help
« Reply #9 on: January 31, 2009, 07:12:55 pm »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
You could probably use all.paused = true and all.paused = false. Something like that probably; I am not sure if that works because I have never really tested it - not sure how objects without a paused variable will be affected.
Logged
Re: Beam of War help
« Reply #10 on: January 31, 2009, 07:30:27 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 245
^^^That could work.

So, any advice on the Beam of War question?
Logged
Re: Beam of War help
« Reply #11 on: February 02, 2009, 10:39:54 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 245
Nevermind about the Beam of War question, I realized that the way I was doing it was stupid to begin with.

Rather than having it be based on a random chance, I'll just use a variable, that when it reaches zero, destroys the instance. And the speed at which the variable goes down is dependent on the strength of the beam in comparison to the opposing beam.  ;) That should work.
« Last Edit: February 02, 2009, 10:42:05 pm by legendarylugi »
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.021 seconds with 62 queries.

anything