Search the Community
Showing results for tags 'height'.
-
Hi! I am loading SVG images in my application. The SVGs don't have a width and height defined in the file, but the viewbox. Loading them basically works with Pixi.js. But my problem is, that those SVG images are rasterized to an image default of 150x150px - in Chrome. In Safari on MacOS they are rasterized MUCH bigger. Is there any option, to tell the Texture Loader to use a given size? This would prevent above behaviour AND give the user the option, to define the size before rasterizing the image. I wouldn't want to set width and height in the SVG files. I looked a lot in BaseTexture and tried loader plugins (e.g. pre), but couldn't find any options to leverage. Any ideas appreciated, on how to tell the Loader which size the SVG should be rasterized Kind regards John
- 6 replies
-
- svg
- rasterization
-
(and 4 more)
Tagged with:
-
I am currently learning Phaser by doing some examples. I am currently here: https://phaser.io/examples/v2/animation/creature-dragon-multiple. I am wondering, how can I set the height and width of `Phaser.Creature` object? The default `height` and `width` are set to undefined. Hence I need to set both height and width in order to set the `Phaser.Creature` dimension. Here are some codes. dragon_character.play(true); // `true` is used for looping forever. dragon_character.scale.set(20); dragon_character.height = 100; dragon_character.width = 100; console.log(dragon_character.height); // 100. console.log(dragon_character.width); // 100. Here are another codes. dragon_character.play(true); // `true` is used for looping forever. dragon_character.scale.set(20); dragon_character.height = 100; console.log(dragon_character.height); // 100. console.log(dragon_character.width); // Undefined. // Additionally the animation does not show up in the screen. If I only set either height or width, the `Phaser.Creature` will not show up in the screen. I don't know if there is no way to set height and let the width adjusted proportionally (vice-versa). Additionally, I could not found a way to get the height and width properties if the dimension is set with `Phaser.Creature.scale.set(25)`. To sum up, my questions: Is there any way to set either height or width and let the un-set properties to adjust in proportion? How can I know the `Phaser.Creature` height and width if it is set with `Phaser.Creature.scale.set()`?
-
Is it possible to set the bump height of a standard material like on the water material? Thanks, Pichou
- 4 replies
-
- bumptexture
- bump
-
(and 2 more)
Tagged with:
-
I've been checking this documentation, but didn't find anything I can use. Please, help.
-
I am having some basic syntax confusion... i have declared a sprite... var taxi = this.add.sprite(100, 100, 'taxi').setOrigin(0, 0); and now would like to resize it I have tried various combos (including ideas from phaser2 i found), what am I doing wrong? taxi.width = 25; taxi.setWidth = 25; taxi.setSize = (25,25); Any help for noob here?
-
I am using this code to create my text field on screen: screenTypingTextField = gameObject.add.text(200, 520, "", si.Utility.getTextStyleScreenTypingTextGreen()); screenTypingTextField.alpha = 0.5; screenTypingTextField.anchor.setTo(0.5, 0.5); //screenTypingTextField.width = 480; //screenTypingTextField.height = 240; thisObject.menuObjects.add(screenTypingTextField); textStyleScreenTypingTextGreen = { font :'70pt Arial', align : 'center', fill: 'Green' }, As you can see I have commented the width and height rows. Its because when i run this code again by entering the same scene that uses this code, it then starts to spread the text over all screen, even bigger. Is this the right way to create text and then set its width and height? Or I should just use the font to set text field size? here is a picture of my typing text field in green spread all over the screen
- 2 replies
-
- phaser 2.6.2
- height
-
(and 2 more)
Tagged with:
-
Hi All, How should I go about obtaining the size of mesh in pixels? Is this even possible ? I assume there is away to obtain measurements for the bounding box or something..? Cheers
-
You set up an application element: g_Pixi = new PIXI.Application(width, height, { backgroundColor: 0x000000 }); document.getElementById(strCanvasDiv).appendChild(g_Pixi.view); 'width' and 'height' are the dimensions of the canvas with id strCanvasDiv.. Question 1: in the object, should I send the canvas in the 'view' element? Ie, g_Pixi = new PIXI.Application(width, height, { view: document.getElementById(strCanvasDiv), backgroundColor: 0x000000 }); But then the user decides he wants to change the dimensions of the screen (which in my code will change the dimensions of the canvas). For example, he could modify the window or even change landscape to portrait. Question 2: What do I do to change the dimensions of the renderer to the new dimensions of the canvas so it all works still?
- 4 replies
-
- application class
- width
-
(and 1 more)
Tagged with:
-
Hi this is my heightmap where blue area is the lowest and orange color is the heightest. However, babylonJS interprets the orange/red color to the lowest zone like blue area. How can change this? Thanks
-
Is there a maximum image width or height for images imported with game.load.image on mobile? I have a sprite sheet that is 3080 pixels wide, and I think it may be the culprit of an error that is happening.
- 5 replies
-
- image
- dimensions
-
(and 2 more)
Tagged with:
-
I saw on original, oimo js website, that it supports physics on irregular terrain. The question is: Does oimo js plugin for Babylon js, can do it too?
-
Hello again. So as stated in the topic title i want to know if there is any alternative for getHeightAtCoordinates function. Here is the solution i thought of: I have a ground 3000x3000 loaded with createGroundFromHeightMap. The problem with getHeightAtCoordinates is that it is too slow. For instance if i have a set of 200 points and if i try to find out the y coordinate for each one using a for loop, the y is set to 0. One solution i thought of(knowing that the ground is not going to change) is to remember in an array all the y coordinates of all points (i know there are 9 000 000 y coordinates for the whole map) - or for the active part of the map; the first time i load up the map. My question would be, is there anyway i can compute the y coordinates, without relying on getHeightAtCoordinates? Thank you in advance. Note: I'm only interested in height where coordinates are whole numbers (ex: y where x=1.0 , z=2.0)
- 39 replies
-
It's just a nightmare Why DisplayObject has no width and height properties?
- 6 replies
-
- size
- Displayobject
-
(and 2 more)
Tagged with:
-
I'd like to get the visual x/y/width/height of a sprite after scaling/skewing/rotating/anchoring it. Can I do that with Phaser? The case: If you flip horizontally a sprite that has {x: 100, y: 100, width: 64, height: 64}, what will your eyes see on the screen? {x: 36, y: 100, width: 64, height: 64}. That's what I'm looking for. However, Phaser tells you:{x: 100, y: 100, width: -64, height: 64}. No big deal, you just do a little math to fix it, kinda like you showed there. That is, if you only scale it. It gets more mathematical when you also change the anchor, and turns into a geometric nightmare if you rotate it too. Phaser is heavily based on Flixel, right? Then my hopes are that you could do it like in Flash, where you can solve all of this by wrapping your sprite into a movieclip and getting the container's x/y/width/height.
-
Hi, First of all, I'm just moving to Phaser game engine to develop even more quality games. I've been using my own game engine and I enjoyed it. But to keep up with the dev speed, developing more game engine features to follow up my need uses too much time than developing the game itself. So I am expecting some of the features may run as my expectation. As I am just jumping to this, I wish for lots of things to learn from you guys. -- I am currently developing a game that is expecting the game screen height not adjusting the size of the game world. Please see below picture on what happened when I have a bigger height/resize the height (Below are samples only, please don't calculate the width/height based on the picture). Normal, expected Bigger height, the game UI is cut as they become larger. The game is scaled bigger, following the height. Even bigger height, the game UI is further cut as they become larger. Same case as previous one, the game is scaled even further, following the height. My expectation is like one of the game I made: http://cake-robot.alectora.com/ Try starting it with your desktop browser with landscape size, and then try playing with only the height. It gives example that it doesn't scale the game size (the sprite size stays the same). The game is only resized when you play the width of the window. I used the game.scale SHOW_ALL (and tried other options), playing with aspect ratios, and still I can't make it like the game I mentioned. Any solution to this? Thank you!
-
Hey, I'm figuring out how to set a pause screen on my vertical platformer game. Everything is working fine, except I don't know how to position the pause screen in the current viewport and not at the complete top of the game. The game itself is 5000px high and the viewport is 600px. I've tried different things, but so far without success. My pause function, which is now positioned at 0, 0 managePause: function () {game.paused = true;var graphics = game.add.graphics(0, 0);graphics.beginFill(000000, 0.5);graphics.drawRect(0, 0, 1200, 600);var vowText = this.add.text(600, 300, vow1, fontStyle);vowText.anchor.setTo(0.5, 0.5);this.input.onDown.add(function() {vowText.destroy();graphics.destroy();game.paused = false;}, this);},
- 2 replies
-
- pauseviewport
- world
-
(and 3 more)
Tagged with:
-
Hi guys, Its posible to get the height of a heightmap given the X and Z coordinates? Here i show an image explaining what i want: Thanks in advance, Carlos R.
-
Hello forum, I am trying to make a grid of DisplayObjectContainers, so I am sorting elements depending on the width and height of each one. I add a Sprite in a container and the problem is when I add a Graphics element of the same size inside the container, the width and height changes. I narrowed the problem here : var cont = new PIXI.DisplayObjectContainer();stage.addChild(cont);var convx = new PIXI.Sprite.fromImage('assets/img.png');//>>>>>>> image is 289x333cont.addChild(convx);var msk = new PIXI.Graphics();msk.beginFill(0x123456,0.5);msk.drawRect(0,0,convx.width,convx.height/2); //>>>>>>> line above makes cont.width and height 309x343 (???)msk.drawRect(10,0,convx.width-20,convx.height/2-10); //>>>>>>> line above makes cont.width and height = is 289x333 (same as the image)cont.addChild(msk);So why does the width and height changes when I draw a Rectangle of the same size in the same container ? Do you have the same problem ? Thank you
-
Hi there, I'm trying to get the width and height from the returned body: var body = this.game.physics.p2.convertCollisionObjects(map, "floorMiddle")[0]; It would be great if this was possible: body.width body.height And, unfortunately the body.sprite=null otherwise I'd just access the sprite info. Thanks, Gar
- 2 replies
-
- p2convertCollisionObjects
- bodwidth
-
(and 1 more)
Tagged with:
-
I currently want to build a game for iPhone (I have a 5s) using Phaser and CocoonJS. I'm just wondering what the best/most optimized initial game size would be for this! aka for this code: var game = new Phaser.Game(800, 600, Phaser.AUTO, 'icicle-man');What would be the best options to replace 800 & 600 with? -Thanks
-
Hi there, I'm wondering, if it is valid/possible to set game width/height after game object initialization? What I'm trying to do is set actual game size in boot state when things such device is available. Unfortunately, it takes no effect on canvas, still the same dimension as once set at game object initialization phase. Any suggestion? Thanks!