Water Physics (attempt) and faster collision free
Posted: Fri Sep 16, 2011 1:49 am
Hello, was messing with water physics just to see what would happen and a sorta nice looking thing came out of it as well as a useful thing. CollisionFree usually takes up a lot of memory and made things lag if used often. I replaced it using this code.
Does the same thing, but instead of "Event Actor" just use x,y for posX and posY. Changed collsionfree to this and it ran at least twice as fast.
Anyway, this is sorta cool looking water here. It flows from an unknown source and fills the holes. Inevitably, after the first is filled and it moves on to the second, it starts to lag. Still neat, though! Check it out please! I'm still trying to optimize it fyi.
- Code: Select all
int check(int posX, int posY)
{
int temp;
Actor * coll;
coll = getactor(posX, posY);
temp = (strcmp(coll->name, "") == 0);
return temp;
}
Does the same thing, but instead of "Event Actor" just use x,y for posX and posY. Changed collsionfree to this and it ran at least twice as fast.
Anyway, this is sorta cool looking water here. It flows from an unknown source and fills the holes. Inevitably, after the first is filled and it moves on to the second, it starts to lag. Still neat, though! Check it out please! I'm still trying to optimize it fyi.