The Daily Click ::. Forums ::. Klik Coding Help ::. Stacking Objects
 

Post Reply  Post Oekaki 
 

Posted By Message

Matt Mallas (Flying Apemonkey Software)



Registered
  20/08/2002
Points
  545
10th August, 2003 at 18:21:43 -

Alright, well I'm making this game where there are containers of Grape Jelly stacked on top of one another. When you hit one container, it is destroyed and all containers above it should fall until they land on another container or collide with the floor. I can get it to work glitch-free for up to 3 containers, but it will not work with any more.

The size of the Jelly is 24 x 55 with hot spot at 12 x 48
The size of the Jelly Mover is 24 x 48 with hot spot at 12 x 48

Here's my code:

"Player" collides with "Jelly"
+Only one action when event loops:
Create "Jelly Mover" at (0,-4 from "Jelly"

"Jelly Mover" is overlapping "Jelly"
+Only one action when event loops:
Create "Jelly Mover" at (0,-4 from "Jelly"

^ Note: These two events effectively create a line of Jelly Movers showing the Jellys to be moved.

"Jelly Mover" is overlapping "Jelly":
Set Y pos of "Jelly" to Y pos of "Jelly" + 2
Add 1 to Alt. Val. A of "Jelly Mover"

Alt. Val. A of "Jelly Mover" = 24
+ "Jelly" is not overlapping "Jelly"
+ "Jelly" is not overlapping "Jelly Mover":
Destroy "Jelly Mover"

^ Note: This event is so that the Jelly does not move if there is a Jelly underneath it. Each Jelly must move 48 pixels for each Jelly that is destroyed underneath it.

"Jelly" is not overlapping "Jelly Mover":
Destroy "Jelly Mover"

If anyone could help me to get this to work with more than 3 containers, your help would be greatly appreciated. I need to have this game finished by Wednesday so I can give it to my friend for her going-away party, so I hope this problem can be solved by then. Thanks in advance for any help!


 
n/a

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
10th August, 2003 at 19:37:39 -

mmmmm Jelly.

well, if it works for three boxes, it should work for more than 3. my guess is that you have too many actives (are you using TGF?). i dont see whats with the jelly mover thing; maybe its me being stupid.

can't you just have:

+ Ever x secs
+ Jelly is not overlapping Jelly
+ Jelly is not overlapping Jelly
+ Set Y of Jelly to "Y of Jelly + 2"

or did i miss something? i am jellied. i mean tired.



 
www.thenatflap.co.uk

Matt Mallas (Flying Apemonkey Software)



Registered
  20/08/2002
Points
  545
11th August, 2003 at 00:01:11 -

Well, I tried that approach, but it didn't work. Also, some Jellys are alone, they're not stacked, so they would fall when there is only one Jelly. The Jelly Mover is just a thing that is created above the Jellys so that only the Jellys above it fall; this object is invisible in the game. It's kind of hard to explain, maybe I'll post an open-source when I get back on my computer. Also, the Jellys have a slight overlap with the other Jellys and the background when they are in their stopped position; this makes it a bit more difficult.

I think it might have something to do with the event "Jelly" is overlapping "Jelly". I think it only recognizes it if one jelly is overlapping another. If two jellys are touching another jelly, it won't work right. Somehow it works with 3, though. I'm not sure how to get it to work with more. I've tried many more methods, but nothing's worked.

Oh, and by the way, I am using TGF, but I don't think it has to do with having to many active objects.

Image Edited by the Author.

 
n/a

ShadowCaster

Possibly Insane

Registered
  02/01/2002
Points
  2203
11th August, 2003 at 05:46:48 -

First of all, there's a problem with TGF when it comes to handling lots of collisions at once. By looking at your code, if you have a lot of jelly (and subsequently, lots of Jelly Mover objects) then that may be where the problem stems from. In this case, you would only be able to fix it by updating to MMF 1.5.

However, I think you're trying to make the problem more complex than it needs to be. If I was coding what you're describing, I would be more inclined to have it hard coded rather than using a bunch of detectors.

Mike

 
"Now I guess we're... 'Path-E-Tech Management'" -Dilbert

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
11th August, 2003 at 05:51:20 -

Yes, that code does seem fine to me. But as SC said, over complicated. You could just make it so if a jelly is not overlapping another jelly, jelly.y + 2 and if a jelly is overlapping another jelly jelly.y - 4. I'm not sure if that would work, because both the jellies could move. If that occurs try adding in + jelly.y < jelly.y

-Andy

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy
   

Post Reply



 



Advertisement

Worth A Click