PDA

View Full Version : for(num=0;num<=240;num++) Question!??



Zim
12-12-2012, 07:39 PM
for(int x=0;x<=240;x++)
{
for(int y=0;y<=160;y++)
{
Screen->ComboD[ComboAt(x,y)=0;
}
}

I wrote this up on here because I wrote up a sideview scrolling screen thing with collision and everything. It works perfectly fine, and can even have multiple floors of walkability on the screen at the same time and everything.. However, it must be written out manually in the script every time at which point the collision and walkability changes, on the graphical part, and swap out the combo on a seperate script..
ZC apparently can't handle the above portion of code without going to some horrendous - number in the fps department. That little code bits along with the next lines of code that assigns which combos on the screen are converted into a solid combo for walkability reasons would make the collision automatically assigned instead of having to write it seperately for every change in elevation.
http://www.youtube.com/watch?v=6LIAtjeFUEA&feature=g-crec-u
There is a link to a video about what I'm talking about here.

The reason why I posted this is to see if the development staff of ZC could possibly expand the allotment of memory for for()s and make it so that ZC could actually handle computing this style of checking, and also, if someone could tell me a way that would work for something like this.
If you're interested I will post up another copy of my current quest file for you to look at.

Saffith
12-12-2012, 08:25 PM
There's no reason to go over every single pixel. There are only 176 combos, but those loops run through 38,801 iterations. Did you mean to do this instead?

for(int x=0; x<=240; x+=16)
{
for(int y=0; y<=160; y+=16)
{
Screen->ComboD[ComboAt(x, y)]=0;
}
}

Or is there something else in the script that really needs per-pixel operations? Even if there is, surely it could be done more efficiently.

Zim
12-12-2012, 11:39 PM
Yes, thanks a bunch again Saffith!! This tidbit has helped me to almost complete the side-scrolling platform. A few more little fixes here and there and it should be ready and user-friendly for people who don't even know how to script.