How would i add gravity to actives and an active with an eight directions movement?
Printable View
How would i add gravity to actives and an active with an eight directions movement?
I learned this one a while ago from the Magician's Lair example game included with TGF. You'll need a second object which is the actual moving object which is always invisible unless it's a shadow. Object 1 can be your player's sprite and object 2 can be the moving object.
If Always
Set X position of object 1 to object 2.
Set Y position of object 1 to (Y of object 2-(Value Y of object 2 / 2))-40
If jump button pressed
If jump flag is off
Set on jump flag
Set value Z to -10(or whatever you want) of object 1
^ The lower the value the higher the jump will be.
If jump flag is on
Subtract value Z from value Y of object 1
Add 1 to value Z of object 1
If Y position of object 1 is greater than Y position of object 2 - 31
Set value Y of object 1 to 0
Set value Z of object 1 to 0
Set off jump flag
Would you mind making an example of this? That would help alot
Also whenever i try to do the y position of object 1 i get a Mixed String and Numbers error
Nevermind I found out the problem
heres what i made following that above but it doesn't work. Could someone fix it and post it here?
http://www.speedyshare.com/434924726.html
One sec and I'll fix it and post it in the file archive section.
Here's the fixed file. http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=58522#Post58522
This is good thanks a lot. But i also want it to be so that you're on the ground and you can jump onto different objects. Something kind of like the original Mario games. Where your on the ground and you can jump onto those block things.
There was an example somewhere someone else made to achieve this but it'll take a lot of work and I don't know if that engine there will be compatible.. I can't remember where it's at..
Ok if you find it post it here and thanks for your help.