Phaser js how to rotate a sprite by an angle, how to change the transparency of a sprite, how to register a collision between two sprites?

Hello, I am studying phaser js, the source site https://www.phaser.io/ created the first game that is presented on the site and started creating its own code
indent preformatted text by 4 spaces

<!doctype html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8" />
    <title>Making your first Phaser 3 Game - Part 3</title>
    <script src="//cdn.jsdelivr.net/npm/phaser@3.11.0/dist/phaser.js"></script>
    <style type="text/css">
        body {
            margin: 0;
        }
    </style>
</head>
<body>

<script type="text/javascript">
    var config = {
    type: Phaser.AUTO,
    width: 768,
    height: 1024,
    physics: {  /* подключение Arcade Physics, поддержку физики*/
        default: 'arcade',
        arcade: {
            gravity: { y: 300 },
            debug: false
        }
    },
    scene: {
        preload: preload,
        create: create,
        update: update
    }
};
    var girl;
var timedEvent;
var platforms;
    var strelka;
    var game = new Phaser.Game(config);
    function preload ()
    {
        /*загружаем данные в загрузчик */
        this.load.image('backgraund', 'sprites/1_0000s_0005_bg.jpg');
        this.load.image('girl', 'sprites/1_0000s_0001s_0000_Layer-981.png');
        this.load.image('labal1', 'sprites/1_0000s_0002_Group-9.png');
        this.load.image('krug', 'sprites/1.png');
        this.load.image('strelka', 'sprites/1_0000_arrowdown.png');
     
    }
    function create ()
    {
        /*создаем размешаем фон координаты указаны по центру но можно по верхенму левому --
        this.add.image(0, 0, 'sky').setOrigin(0, 0)*/
        platforms = this.physics.add.staticGroup();
        platforms.create(0, 703, 'girl').setOrigin(0, 0);
        this.add.image(0, 0, 'backgraund').setOrigin(0, 0);
      girl= this.add.image(0, 703, 'girl').setOrigin(0, 0);
        this.add.image(130, 469, 'labal1').setOrigin(0, 0);
        
       strelka =  this.add.image(320, 670, 'strelka').setOrigin(0, 0);
        
        /*
        
        this.add.overlap(girl, strelka, collectStar, null, this);
        */
timedEvent = this.time.delayedCall(5000, onEvent, [], this);
          
    }
    function update ()
    {
         girl.x = girl.x +10;
        strelka.y = strelka.y + 10;
        
        /*
        console.log(girl.Alpha);
       console.log(girl.globalAlpha);
       console.log(girl.opacity);
        Phaser.Actions.SetAlpha(girl, 0.5, 0.5);
        girl.globalAlpha = 0.5;
        girl.Alpha = 0.5;
        girl.SetAlpha = 0.5;
      
            girl.frame.pivotY =10;
        girl.frame.pivotX =10;
        girl.frame.rotated = 100;
        */
    }
    function onEvent ()
{
    this.add.image(-30, 731, 'krug').setOrigin(0, 0);
   /* girl.kill();*/
    girl.destroy(true); 
    girl = 'null';
    
     
}
    
    function collectStar () {
    console.log("huy");
    }
</script>

</body>
</html>

the question is trying to implement for educational purposes

  1. turn the corner girl
  2. change the transparency of the girl
  3. execute output to the console at the intersection of the girl and the arrow

I immediately apologize for the question from the category “for dummies” that I first studied the Phaser js on the Phaser website that I found could not realize this can be seen in the comments code / ** / thank you all in advance …

Welcome Gora,
Since you are just starting out, I would highly recommend you visit Phaser’s lab site. This site will give you code examples for basic implementations of things, like what you’re asking for.

Key terms you’ll be interested in are:
setOrigin
alpha
collision

thanks but don’t get it
Phaser.Actions.RotateAround( girl, { x: 400, y: 300 }, 0.01);

To rotate the girl, place the following in your update loop.

For the top-left corner:

girl.setOrigin(0, 0);
girl.angle++;

For the top-right corner:

girl.setOrigin(1, 0);
girl.angle++;

For the bot-right corner:

girl.setOrigin(1, 1);
girl.angle++;

For the bot-left corner:

girl.setOrigin(0, 1);
girl.angle++;

thank

1 Like