1. Home
  2. /
  3. Phaser3
  4. /
  5. Phaser 3 Random Stars

Phaser 3 Random Stars - Phaser3 Typing CST Test

Loading…

Phaser 3 Random Stars — Phaser3 Code

Creates stars at random positions every frame.

# phaser3/demo/random_stars.html
<html>
	<head>
	<script src="https://cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.min.js"></script>
	</head>
	<body>
	<script>
		const config = { type: Phaser.AUTO, width: 800, height: 600, scene: { create, update } };
		const game = new Phaser.Game(config);

		let stars = [];
		function create() {}
		function update() {
		const x = Phaser.Math.Between(0, 800);
		const y = Phaser.Math.Between(0, 600);
		stars.push(this.add.circle(x, y, 5, 0xffff00));
		}
	</script>
	</body>
</html>

Phaser3 Language Guide

Phaser 3 is a fast, open-source HTML5 game framework for creating 2D games for the web and mobile. It provides a complete ecosystem for rendering, physics, input, audio, and animation, allowing developers to build rich, interactive games in JavaScript or TypeScript.

Primary Use Cases

  • ▸2D browser-based games
  • ▸Interactive educational content
  • ▸Gamified UI experiences
  • ▸HTML5 advertising and promotional games
  • ▸Rapid prototyping of interactive experiences

Notable Features

  • ▸WebGL and Canvas rendering support
  • ▸Physics engines: Arcade, Matter.js, Impact
  • ▸Tilemaps for 2D worlds
  • ▸Sprite animations, particle systems, and tweens
  • ▸Scene management and modular game architecture

Origin & Creator

Phaser was originally created by Richard Davey and maintained by Photon Storm, with Phaser 3 released in 2018 as the modern version of the framework.

Industrial Note

Phaser 3 is widely used for web-based games, educational games, interactive demos, gamified apps, and HTML5 advergames.

More Phaser3 Typing Exercises

Simple Phaser 3 ScenePhaser 3 Moving CirclePhaser 3 Keyboard InputPhaser 3 Bouncing SpritePhaser 3 Mouse DragPhaser 3 Animated SpritePhaser 3 Collision ExamplePhaser 3 Tilemap Example

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher