The Daily Click ::. Forums ::. Klik Coding Help ::. Monsters with their own individual events.
 

Post Reply  Post Oekaki 
 

Posted By Message

eyeangle



Registered
  12/06/2003
Points
  1683
28th September, 2007 at 04:29:48 -

Two questions I've got here:

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

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
28th September, 2007 at 10:32:38 -

For point 1, give instances of an object unique IDs by spreading a value. Check out this article to learn more about that: http://www.create-games.com/article.asp?id=1798

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

 
Old member (~2004-2007).

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
28th September, 2007 at 10:35:13 -

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

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
28th September, 2007 at 10:44:36 -

Funny, I just wanted to edit my post to suggest the usage of using object behaviours.

Don't know if it'd work, though.

 
Old member (~2004-2007).

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
28th September, 2007 at 12:10:18 -

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!

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
28th September, 2007 at 12:40:11 -

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")

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
28th September, 2007 at 13:26:36 -

Great, thank you Axel, you win today's medal!

 
--

"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!

eyeangle



Registered
  12/06/2003
Points
  1683
28th September, 2007 at 22:02:44 -

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.

Image Edited by the Author.

 
theonecardgame.com

»xerus



Registered
  28/06/2002
Points
  675

You've Been Circy'd!Game of the Week Winner
28th September, 2007 at 22:27:51 -

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.

 
n/a

eyeangle



Registered
  12/06/2003
Points
  1683
29th September, 2007 at 02:46:24 -

Hahaha, man there's so many events it is madness!

I'll try that.

 
theonecardgame.com

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
29th September, 2007 at 03:59:24 -


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 =(

Image Edited by the Author.

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
29th September, 2007 at 04:07:00 -

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 =/

 

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
29th September, 2007 at 19:09:17 -

Behaviours don't handle qualifiers either I don't think.

 
Image
http://bfollington.tumblr.com

Deleted User
29th September, 2007 at 22:21:59 -

How odd... I seem to remember Behaviours used to handle Qualifiers. Well, I sigh for the worse. =/

 
   

Post Reply



 



Advertisement

Worth A Click