Search Results

Tuesday, September 6, 2011

BGHelper V1.5 - Nodes and Gradual Ranges

Hey. So here's another release of BGHelper. This one has a couple of new features.



The first is a new gradual range class. Say you want to loop through a range of objects in the game, but you don't want to do it all at once. You want to do it gradually. Well, this class helps with that. It allows you to create a range of numbers, like the built-in range() function of Python, but returns just a portion of the full range, the amount of which you specify. Next time you call it, it returns another portion of that same range. For example,

obj['cr'] = CGRange(10, 2) # A range from 0 - 10, returning 2 numbers each time you call its Next() function

n = obj['cr'].Next() # Returns [0, 1]

n = obj['cr'].Next() # Returns [2, 3]

And so on. I've included an example in the associated blend file showing this process.

Another addition is Node-based path following. You simply specify the path, and the CNodePath class will allow you to move along the path from beginning to end, and if you wish, to turn around. To do this, you simply set the path object's oncomplete variable to 1. I've included an example of this, as well.

I also added a function to switch a variable between two values called Reverse. You would use it like:

x = 1

x = Reverse(x, 1, 10) # x = 10 now

x = Reverse(x, 1, 10) # x = 1 again because it's been reversed

Download the BGHelper module below.

Mirror 1 - MediaFire
Mirror 2 - FreeDrive

No comments:

Post a Comment