Username
Password
Are you new? Sign up now
I’ve forgotten
Home
:.
Downloads
:.
Articles
:.
Projects
:.
Reviews
:.
Forums
:.
Arcade
:.
Klikcast
:.
GOTW
The Daily Click
::.
Forums
::.
Klik Coding Help
::.
Apply gravity to multiple objects without reams of code and extensions
Post Reply
Post Oekaki
Posted By
Message
lembi2001
Registered
01/04/2005
Points
608
14th May, 2012 at 14/05/2012 12:10:43 -
I am making a quick puzzle game and need to add some gravity to a few objects. I can best describe this using a diagram.
X's are objects
O's are blank space and can be ignored
W's are the Wall tiles
OOOOOXXW
OOOOXXXW
OOOXXXXW
OOXXXXXW
XXXXXXXW
XXXXXXXW
XXXXXXXW
WWWWWWWW
Ok, so what i need to do is apply some gravity to the X's taking into account the stacking and also the interaction with the wall tiles.
I know it's really easy but i have been staring at this code for hours now and my eyes are melting and my brain has switched off!!
Please can anyone help a senile man??
n/a
nivram
Registered
20/07/2006
Points
171
14th May, 2012 at 14/05/2012 15:46:25 -
If all your objects will have the same code, put them into a qualifier. That way you only have to do the code once for the gravity.
Marv
458 MMF2 & CTF 2.5 examples and games
http://www.castles-of-britain.com/mmf2examples.htm
UrbanMonk
BRING BACK MITCH
Registered
07/07/2008
Points
49667
15th May, 2012 at 15/05/2012 21:12:48 -
If the game is grid based then you could perform distance checks, and have the amount each object has to move stored in a alterable variable.
That's how I did it with my game Smart Klik:
http://jsoftgames.com/arcade.php?subaction=showfull&id=1245730619&archive=&start_from=&ucat=5&
n/a
s-m-r
Slow-Motion Riot
Registered
04/06/2006
Points
1078
15th May, 2012 at 15/05/2012 22:00:06 -
If you had the issue of KlikZine that featured Kisguri's 'bejeweled' engine, you'd have no problem with this. I'm fiarly sure it's the
October
August
'09 issue.
http://www.clickteam.com/website/usa/klikdisc
Edited by s-m-r
n/a
Post Reply
1
All
Advertisement
Worth A Click