Scripts / Display image at start of level

Author
Message
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 25th Aug 2019 14:23 Edited at: 25th Aug 2019 15:30
Hi all

So I want to show a full screen image when the level starts, while I can do that no problems there are a couple issues I just can't seam to resolve.

1) I would like the image to be displayed immediately when level has loaded, but there is like a split second or so before the image appears.

2) The image is semi-transparent, and appears darker than it should, it looks to me like it gets displayed twice.

This is what I have thus far.


Any ideas what I be doing wrong....

Thanks for any input

Reliquia....
aka OldFlak
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 25th Aug 2019 17:11
change the setposition to 200,200 or remove the pastesprite command as you are creating the sprite at 0,0 then pasting the same sprite on top of it

don't see any reason for any delay, probably just normal delay for GG to run the script
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 25th Aug 2019 19:36
Please someone could give a quick run- down of the sprite commands?
Thanks.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 25th Aug 2019 19:49
The descriptions are in global.lua.
Been there, done that, got all the T-Shirts!
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 25th Aug 2019 20:13
And are really unhelpful descriptions because they dont explain in easy terms how they interact with each other.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 25th Aug 2019 20:40
CreateSprite: mySprite = CreateSprite ( myImage )
PasteSprite: PasteSprite ( mySprite ) -- pastes the sprite at its current location (good for pasting sprite BEHIND text)
PasteSpritePosition: PasteSpritePosition ( mySprite , x , y ) -- as above but pasted at a specified XY coordinate
DeleteSprite: DeleteSprite ( mySprite )
SetSpritePosition: SetSpritePosition ( mySprite , x , y )
SetSpriteSize: SetSpriteSize ( mySprite , sizeX , sizeZ ) -- passing -1 as one of the params ensure the sprite retains its aspect ratio
SetSpriteDepth: SetSpriteDepth ( mySprite , 10 ) (0 is front, 100 is back)
SetSpriteColor: SetSpriteColor ( mySprite , red , green, blue, alpha )
SetSpriteAngle: SetSpriteAngle ( mySprite , 180 )
SetSpriteOffset: SetSpriteOffset ( mySprite , 5 , -1 ) -- would be the centre for a 10% width image assigned to a sprite, passing -1 as one of the params ensure the sprite retains its aspect ratio
SetSpriteImage: SetSpriteImage ( mySprite , myImage )

Which ones?
Been there, done that, got all the T-Shirts!
PM
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 25th Aug 2019 23:18
Quote: "change the setposition to 200,200 or remove the pastesprite command as you are creating the sprite at 0,0 then pasting the same sprite on top of it"

Ah, ok, will give it a try. Had the impression createsprite only loaded it in memory, and pastesprite displayed it

Thanks

Reliquia....
aka OldFlak
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 25th Aug 2019 23:41
nope, paste sprite was added after we realised we couldn't see text in front of sprites but is handled differently, you need to constantly call pastesprite to keep it on screen while a normal sprite should be created outside of the loop as it stays on screen til you delete it or move it off (you did both correctly, i'm just clarify for others)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 26th Aug 2019 01:02
Thanks smallg appreciated, displays proper now

Kinda liking this coding thing, but for the headaches lol...

Still trying to work out how to avoid the delay when it is displayed.

Also anyone explain why\when\what we should or shouldn't make use of the function_init section...

Thanks
aka OldFlak
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 26th Aug 2019 09:18
Init is run once when the script is first run, it is for any starting settings related to the model (or other models) which require the entity number.
I.e. SetActivated(e,2) or PlayAnimation(e)

Otherwise general script settings can be defined and set outside the init
I.e. local first_run = 0

Then the main function is called repeatedly until the engine is told not to (i.e. the health reaches 0) - general game and (this) entity logic goes here

Then the preexit is called (pretty sure this is only for characters) - this is for handling death animations etc

followed by the exit - this is for clean up (delete any images, destroy the entity)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-12-22 08:58:11
Your offset time is: 2024-12-22 08:58:11