Google Game Builder programozás, játékfejlesztés

kód:

*****************************

// Example card.

// User-editable properties for this card:
export const PROPS = [
propNumber(“Duration”, 1),
propColor(“Alap”,”#ff0000″),
propColor(“Feher”,”#ffffff”),
];

export function onInit() {
setTintColor(props.Alap);
}

// onTick is called every frame (50-60 times per second).
export function onTick() {
// Uncomment the line below to make the actor move forward, at the
// speed that was set in the properties.
// moveForward(props.speed);
}

// onCollision is called when the actor collides with another actor:
export function onCollision(msg) {

setTint(0,1,0);

sendToSelfDelayed(props.Duration, “RestoreColor”);

moveForward(50);

// To print a log message, uncomment this: (press ~ to show console)
//log(‘I collided with ‘ + getDisplayName(msg.other));

// onCollision() get called continually while the actors are colliding,
// so if you want to put a delay between calls, use a cooldown:
cooldown(1);
}

export function onRestoreColor(){
setTintColor(props.Feher);
}

*****************************