Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,767 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Muzzle flash #177168
01/08/08 21:55
01/08/08 21:55
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
I'm experimenting with muzzle flash sprites.
I have this script now:

Code:
function muzzle(){
var tmpx = random(0.3)+0.5;
muzzle_pan.scale_x = tmpx;
muzzle_pan.scale_y = tmpx;
muzzle_pan.pos_x = (screen_size.x - bmap_width(muzzle_pan.bmap))/2;
muzzle_pan.pos_y = (screen_size.y - bmap_height(muzzle_pan.bmap))/2;
muzzle_pan.flags = VISIBLE | OVERLAY;
wait(-0.05);
muzzle_pan.flags = 0;
}


I also have a center screen screen script, the 2 longer lines of coding.
But the center screen script doesn't work on my random resize script, hoe can I make it so that the muzzle always displays in the center?


The best games are the games you create yourself.
Re: Muzzle flash [Re: NL_3DGS_n00b] #177169
01/09/08 04:26
01/09/08 04:26
Joined: Dec 2006
Posts: 78
Nevada, USA
Futurulus Offline
Junior Member
Futurulus  Offline
Junior Member

Joined: Dec 2006
Posts: 78
Nevada, USA
That's the exact same formula I use to put a crosshair in the center of the screen, and mine works fine. What's going wrong, specifically?

EDIT: oops, saw it right after I posted...Try this:
Code:
muzzle_pan.pos_x = (screen_size.x - bmap_width(muzzle_pan.bmap) * tmpx) / 2;
muzzle_pan.pos_y = (screen_size.y - bmap_height(muzzle_pan.bmap) * tmpx) / 2;


bmap_width and _height always give the size of the original image, not the scaled panel.

Last edited by Futurulus; 01/09/08 04:30.
Re: Muzzle flash [Re: Futurulus] #177170
01/09/08 06:03
01/09/08 06:03
Joined: Jul 2005
Posts: 262
Earth, The Netherlands
NL_3DGS_n00b Offline OP
Member
NL_3DGS_n00b  Offline OP
Member

Joined: Jul 2005
Posts: 262
Earth, The Netherlands
Thank you very much.
Working fine now.

Another question, is there also a script to find out the width in pixels off a Text panel, so I can center text panels on screen?


The best games are the games you create yourself.
Re: Muzzle flash [Re: NL_3DGS_n00b] #177171
01/12/08 18:05
01/12/08 18:05
Joined: Dec 2006
Posts: 78
Nevada, USA
Futurulus Offline
Junior Member
Futurulus  Offline
Junior Member

Joined: Dec 2006
Posts: 78
Nevada, USA
Actually, with texts you don't need to know the width; the CENTER_X and CENTER_Y flags do this for you. Just make sure pos_x and pos_y are in the center of the screen (screen_size.x / 2, screen_size.y / 2).


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1