Splash help
Displaying 1-4 of 4 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
spaceseel

I'm trying to get a VERGE 3 Logo to zoom in from the center. So far, I've failed to do this. I don't know what I'm doing. The code below is what I've been trying to fix:


void loadIntro() //Verge 3 Splash Logo
{
Log("Loading VERGE 3 Splash...");
int v3logo = LoadImage("data\images\V3Splash_640.png"); //logo for the VERGE 3 engine baby!
int v3fog = LoadImage("data\images\fog.png"); //fog effects for the background
int i, r;
int xCent = ImageWidth(screen)/2;
int yCent = ImageWidth(screen)/2;
int xlogo = 336; //the center point of the splash logo
int ylogo = 460;

for(i=0;i<100;i++)
{
Render();
RectFill(0,0,640,480,RGB(0,0,0),screen);
TScaleBlit(0,0,xlogo+i,ylogo+i,v3logo,screen);
ShowPage();
}
EnterWait();
}

Posted on 2007-03-11 04:02:42

Beni

I found the following problems with the code
The 3rd and fourth parameters of ScaleBlit are the width and height you want the image to have. So to have a zooming effect, those need to increase from zero to however large you want it to end up as.
Instead of just having a for loop counting from 0 to 100, you probably would want to involve a timer so it runs at the same speed on all computers.
The variables for the center of the logo are unnecessary.
The xCent and yCent, (which you created but don't use), need to be used in the first two parameters. But with negative offsets of half the current width and height of the scaled blit.
The call to Render() is unnecessary.
Also, you accidentally made the yCent to be half the width of the screen instead of the height.

Here is a version that I tested on my computer.


void ZoomLogo()
{
int v3logo = LoadImage("v3logo.png"); // change this to load your image obviously
int xCent = ImageWidth(screen)/2;
int yCent = ImageHeight(screen)/2;
int logoW = ImageWidth(v3logo);
int logoH = ImageHeight(v3logo);
int i, w, h;

int max_timer = 400; // will cause this to take 4 seconds

timer = 0;
while(timer < max_timer)
{
RectFill(0,0,640,480,RGB(0,0,0),screen);
w = logoW * timer / max_timer;
h = logoH * timer / max_timer;
TScaleBlit(xCent - (w/2), yCent - (h/2), w, h, v3logo, screen);
ShowPage();
}
EnterWait();
}

Posted on 2007-03-11 06:55:47

spaceseel

Thanks! That really helped. Now what I'm doing is making a tiled background out of an image. The background image would scroll to the left real slowly. I've been trying to find the command, but unsucessful so far.

Posted on 2007-03-11 14:36:07

spaceseel

Never mind. Found it. Had to use WrapBlit() instead of BitWrap().

Posted on 2007-03-11 14:40:29


Displaying 1-4 of 4 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.