Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

phaser time event start at

function create ()
{
    image = this.add.image(400, 300, 'einstein');

    text = this.add.text(32, 32);

    //  A 10 second delay, but the first time it begins it'll start 5 seconds in, then on repeat will repeat for the full 10 seconds
    timedEvent = this.time.addEvent({ delay: 10000, callback: onEvent, callbackScope: this, repeat: 1, startAt: 5000 });
}

function update ()
{
    text.setText('Event.progress: ' + timedEvent.getProgress().toString().substr(0, 4) + '
Event.repeatCount: ' + timedEvent.repeatCount);
}

function onEvent ()
{
    image.scaleX *= 0.75;
    image.scaleY *= 0.75;
    image.rotation += 0.04;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: phaser rotate matrix 180 
Javascript :: phaser move towards object 
Javascript :: javascript server side 
Javascript :: switching light bulbs problem javascript 
Javascript :: What is an array? Is it static or dynamic in Javascript 
Javascript :: Creating Genesis Block for blockchain 
Javascript :: Sorting the Odd way! 
Javascript :: barcode javascript library 
Javascript :: jquery ajax success function not executing 
Javascript :: react sate and props 
Javascript :: append vs appendchild 
Javascript :: Download A File With Link Using ExpressJS 
Javascript :: Viewing Your React App On Another Device 
Javascript :: prisma Return a relations count with include 
Javascript :: Hardhat deploy sample js code 
Javascript :: trigger oninput of input js 
Javascript :: todo app html css javascript 
Javascript :: vue2-datepicker nuxtjs example 
Javascript :: required field in javascript dynamically 
Javascript :: backbone view initialize 
Javascript :: How many options are there to climb a ladder with N 
Javascript :: Solution-2--solution options for reverse bits algorithm js 
Javascript :: convert string to number 
Javascript :: js function to print word starts with vowels of given string 
Javascript :: dom traversal jquery 
Javascript :: comment field react 
Javascript :: nextjs apollo 
Javascript :: JavaScript (SMonkey 60.2.3) sample 
Javascript :: EFSavechanges 
Javascript :: JavaScript for loop Display Numbers from 1 to 5 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =