The RPG Maker Resource Kit

Other Game Creation => Other Game Making Programs => Topic started by: &&&&&&&&&&&&& on November 03, 2007, 11:36:29 PM

Title: [GM] winner
Post by: &&&&&&&&&&&&& on November 03, 2007, 11:36:29 PM
I have it set, for every enemy you kill, the variable win gets +1. I want it to say "you win" when you get 5 in win. To my small mind, it seems like what I have should work... but it doesn't.


Attached.
Title: Re: winner
Post by: J-Crew on November 04, 2007, 01:13:17 PM
I'm going to fix it, but I'm going to change a few things around if thats alright with you. Because at this point, it's too messy for me to do anything with it. I'll probably use GML coding for most of it, but I'll put detailed comments in it to help you understand.

Edit:
OK It's done. I changed alot on it, but it does the exact same thing. It's just way more organized now. I made it use less objects to get the job done. It no longer needs the wall object because I set the ship and enemy limit by room size and whatnot. The problem you were running into with the variable "win" is that you made each object (ship,enemy,winner) have their own variable called "win". This made it so that each could only add up to one, rather than having on variable that could possibly add up to five. An easy way around this is using global variables. I didn't use any in this example because they can get difficult to remember, and use up game memory. So I just gave the object "Winner" the variable "win" and all other objects that read the variable read it from object "Winner". Now all you have to do is make a graphic for "You Win" and put it in the object "Winner". If you need a better explanation of this, I'll be here.

Also I changed the health system. You no longer need multiple objects to display the hp. There is only one object and one hp variable. The object I made draws health for up to 5 health points if you want to use more. The new object is called "Hp_Drawer" and the hp for the ship is managed by it. So when referring/setting the hp for the ship use "Hp_Drawer.hp = #".

If you need help with any of the changes I've made, read the comments in the pieces of code or just ask me in this topic. Oh and here's a plus! The file size went down!
Title: Re: winner
Post by: &&&&&&&&&&&&& on November 05, 2007, 03:42:06 AM
Thank you.
You helped me greatly, and I see what you did thar.  :D

Oh, and can you help me make them shoot randomly, and not all at once?  ???
Title: Re: winner
Post by: J-Crew on November 05, 2007, 11:21:10 AM
Sure! I'll look at it again when I get home tonight. But school is calling.

Edit:
Ok I made them fire at random intervals between 5 and 40 steps. You'll see in the step event of the baddy there is a comment that tells what to change if you want to make the random wait times slower. Also from a players point of view, I think you should move the ship down some to allow the player to have more time to dodge the enemy bullets. I think it's a bit too hard the way it is. But that's just my personal opinion. Ignore me if you think it's fine.
Title: Re: winner
Post by: &&&&&&&&&&&&& on November 05, 2007, 10:59:27 PM
Also from a players point of view, I think you should move the ship down some to allow the player to have more time to dodge the enemy bullets. I think it's a bit too hard the way it is. But that's just my personal opinion. Ignore me if you think it's fine.

better?

(oh, and do you have AIM or MSN?) EDIT - >_> o, i c there, is says you have aim, I need to look first.
Title: Re: winner
Post by: J-Crew on November 05, 2007, 11:16:28 PM
It's much better! the larger screen size makes it a lot better. Oh yeah and there's one thing you may want to get rid of. In the object "gameover" I put a game restart thing by pressing F12. I only used it for tests but you may want to ged rid of that.
Title: Re: winner
Post by: &&&&&&&&&&&&& on November 11, 2007, 11:08:54 AM
How would I make the ship level up?

Quote
if self.level = 1
self.hp = 2
if self.level = 2
self.hp = 2
if self.level = 3
self.hp = 3

Would it be something like this?
Title: Re: winner
Post by: J-Crew on November 11, 2007, 01:52:20 PM
First you'd have to define a variable called level for the object "Ship" and set to 1, because that's what you want the initial level to be I'd assume. Next, what I did was make a script called level up with the following code:
Code: [Select]
Ship.level = argument0

if Ship.level = 1
 {self.hp = 2}
if Ship.level = 2
 {self.hp = 3}
if Ship.level = 3
 {self.hp = 4}
if Ship.level = 4
 {self.hp = 5}

Now when you want the ship to level up, you call this script in the "Hp_Drawer" object and you set argument 0 to the desired ship level. The script will handle it from there.