when the warrior finishes the level I want to present a VICTORY graphic in the middle of the screen.
It needs to slowly appear, either by :
Opacity (alpha from 0.0 --> 1.0)
Size (from miniscule —> to normal size)
Or preferably both.
I had done [2] before in a smoke effect (the puffs started out small and grew in size while they moved up).
I do not remember exactly how, but I think I changed .scale property (or something like this) via Python.
Number [1] (alpha channel) = I have no idea how to do …
Any ideas ? A rough suggestion will be fine, I can take it from there.
Properties panel->Object Tab->Display->Object color. You need to tick the “object color” checkbox in your material options for this to work. This also enables you to manipulate the attribute through python.
Yes you are right, it works in animation (click play button in the timeline window), but not in the game (press P button).
But now that I think about it, it is better this way. It is best to animate the Object, instead of the Material. Because the Material animation
will force all objects using it to behave the same way –> not flexible.
import bge
cont = bge.logic.getCurrentController()
own = cont.owner
anykey = cont.sensors['anykey01']
scene01 = cont.actuators['scene01']
scene02 = cont.actuators['scene02']
speed = own["speed"]
colour = own["colour"]
if anykey.positive and colour >= 1.0:
own["play"] = False
if own["play"] == True:
if colour <= 1.0:
own["colour"] += speed
else:
if colour >= 0:
own["colour"] -= speed
own.color[3] = colour
if colour < 0:
cont.activate(scene01)
cont.activate(scene02)
victory_test02.blend (543 KB) of course, of course, this file is a free extended help on BGE - with scripts it’s easier to work
I hope this helps you …
Wow this is awesome. So colour[3] is the alpha channel and you simply assign it values ?
Could not get better than this !
Meanwhile I have made the Victory message with animating the Object Color as stated in previous messages.
It is a simple message so no big requirements there (It does not even have a script, only logic blocks)
HOWEVER, this solution has much potential and I will definitely use it for particles flying in the air
(for example when two swords collide, spawn tiny bright cubes that slowly shrink and disappear –> sparks)
Thanks a lot, this has many many uses, will definitely use it.