1) I need to make a baddie that moves along (platform) and shoots at you when you get too close it it. I've worked out the AI but I can only put one moster in because it uses a fast loop and stuffs up if there more then one. So yeah is it possible to give an object its own group of events?
2) I have an object that moves <---left---right---> at the bottom of the screen. I need to make it so it randomly shoots a fireball up at a random height and falls down again?
- Thanks heaps -
theonecardgame.com
DaVince This fool just HAD to have a custom rating
For 2:
- Value A of object = 0: set value B to 100+Random(50) (you can change the 100 and 50 to how many frames you want to wait before randomly shooting. 50 frames = 1 second.)
- Always: add 1 to value A
- value A >= value B: create ball; set value A to 0
DaVince, could he also use behavior events? I've never got it to work right but it sounds like he wants each monster to have the same set of events doesn't it?
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
28th September, 2007 at 10:44:36 -
Funny, I just wanted to edit my post to suggest the usage of using object behaviours.
How do behaviour events work? What I mean is, does it work like global events do? I don't put too much stock in global events for the most part. How would you tie an enemy to a set of behaviour events?
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
1) I've never used behaviours, so I'm not completely sure how they work, but here's what I usually do:
* Always
- Monster: Spread 0 in Value A
* Always
- Start loop "foo" NObjects("Monster") times
* On loop "foo"
* Value A of Monster == LoopIndex("foo")
- [Insert code here]
2) Use an alterable value to store the Y velocity of the fireball:
* [event]
- Create Fireball at (0;0) from SomeObject
- Fireball: Set Value A to (0 - (Random(21) + 10)) (Generates a random number between -10 and -30, you can change it if you want)
* Always
- Fireball: Add 1 to Value A
- Fireball: Set Y position to Y("Fireball") + Alterable Value A("Fireball")
In relation to question 2, thanks Axel, it's beautiful... it brought tears to my eyes and it's only two events. Thanks.
Question 1 I don't understand: what do you mean by [Insert code here]. There are alot of events under my Baddie with its fast loop for gravity and all that.
So, in regards to question 1 you're trying to make multiple baddies use a fast loop platform engine? As far as I know, not going to happen.
Instead, try making the fast-looping platform engine for a Qualifier/Group, and then throw the baddie in the group. Thats the only way I can think of overcoming such madness.
Originally Posted by »xerus So, in regards to question 1 you're trying to make multiple baddies use a fast loop platform engine? As far as I know, not going to happen.
Noes! I've done it many times before, and it's very much possible. Simply use the code I posted above.
Originally Posted by Edwin Street
Question 1 I don't understand: what do you mean by [Insert code here]. There are alot of events under my Baddie with its fast loop for gravity and all that.
It's quite simple: Copy/paste those two conditions into every enemy-related line of code. Note that the "On loop" condition always has to be checked first. It may requite some tweaking though, depending on how your movement engine works, but I can help you out if you struggle.
PS: The "spread a value" and "start loop" actions have to be on two separate events, due to an annoying MMF bug. I learned that the hard way =(
Actually, I think I'll just make an example file, so you can have a look at the full source yourself. It might take a while though, because my home internets are sort of BROKEN at the moment =P
n/a
Deleted User
29th September, 2007 at 13:59:55 -
Something you might want to consider is the fact that normal events run first, then global events and then behaviours. If your events are interconnected, you might want to do code your game in the normal events, or in the behaviours (which work just as well). Global events don't handle Qualifiers =/