Just started learning phaser 3 with little prior JS experiecne.
While instantiating game with required configs, the width value defaults to 1024. how do I set width value to my value.
// Class main.js
var config = {
widht : 200,
height : 200,
type : Phaser.AUTO,
parent : 'phaser-example',
backgroundColor : '#18318C',
physics:{
default : 'arcade',
arcade:{
gravity: {y: 200}
}
},
scene: [Scene1]
};
var game = new Phaser.Game(config);
//index.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<link rel="stylesheet" href="styles.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,
minimum-scale=1, user-scalable=no" /> <!-- used to prevent zoom in/out-->
<title>Game</title>
<script src="js/phaser.js"></script>
<script src="js/Scene1.js"></script>
<!-- include main game file -->
<script src="js/main.js"></script>
<style>
body{
padding:0px; margin:0px; background: black;
/* fill screen black */
}
</style>
</head>
<body>
<div class="main_canvas" id="phaser-example">
</div>
</body>
</html>
//style.css
.main_canvas{
background-color: red;
position: fixed;
top: 50%;
left: 50%;
/* bring your own prefixes */
transform: translate(-50%, -50%);
width: 300px;
height: 600px;
}