Simple gravity script with Multiplier

Game Editor comments and discussion.

Simple gravity script with Multiplier

Postby Hblade » Thu Oct 11, 2012 5:44 am

This is a simple script that I find rather useful! Especially when having larger enemies or other weighted objects.

How it works:
Basically you put the command setGrav(1) where 1 is the multiplier. You can make something light as a feather and make it fall super slow or heavy as can be and make it fall super fast. you also may be able to reverse gravity this way. Haven't tried it.

Heres the script:
Code: Select all
double gravity=.5;
void setGrav(double multiplier)
  {
      yvelocity+=gravity*multiplier;
  }


This needs to be put in Global Code somewhere.

Enjoy
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Simple gravity script with Multiplier

Postby MrJolteon » Thu Oct 11, 2012 5:47 am

Hblade wrote:you also may be able to reverse gravity this way. Haven't tried it.

It's possible, just set setGrav to a negative number.
Join us on Discord!
Game Editor 2
These are the best ways to reach me these days


Your local Community Janitor, always lurking in the shadows...
User avatar
MrJolteon
 
Posts: 2326
Joined: Sat Aug 09, 2008 3:25 pm
Location: Stranded under endless sky
Score: 105 Give a positive score

Re: Simple gravity script with Multiplier

Postby Hblade » Fri Oct 12, 2012 4:41 am

yep. I dont use GE too much anymore, I don't really have any game ideas lately.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest