Davaaron

Members
  • Content Count

    25
  • Joined

  • Last visited

About Davaaron

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. You need to add the new javascript file to the index.html file like <script src="path/to/your/jsfile/jsfilename.js"></script>
  2. Davaaron

    Scale states

    Hi, what do you do if you have the following case: You program a game for mobile devices which is a jump and run game. The dimension used to initialize the game world is like 640x480, but you have pictures used as background that are much bigger, like 1800x1200. It's also possible that some background images will be smaller or bigger. My idea was maybe to scale up the camera or game size dependent on the size of the background image. But I don't know how to scale all images within the viewport. How do you solve such issues? I mean I would need to scale down all the images. Or at least provide multiple resolutions for different devices and decide on runtime which asset to load?
  3. Unfortunately, the plugin is not working for me tho (Android). But it works on iPhone 6. The event KeyBoard.open and KeyBoard.close are triggered on android (i change a visible text), but no keyboard is popped up.
  4. Davaaron

    Input field

    Hi, is there any solution to add an input field to the canvas? I would like to let the user enter its name. On mobile, the Phaser.Input Plugin does not open the keyboard, although I call focus (it is focused, but there is no keyboard opened). I tried CanvasInput but it is not even showing up in the canvas. Appreciate your help. Edit: the Phaser.Input Plugin works for iOS, but not for Android. If everything would be standardized... a dream.
  5. Hi, i'm sticking together multiple sprites and do some translation and rotation with the parent sprite. All children sprites behave like expected, rotating with the parent sprite around its center point. But one sprite doesn't do so. It came to my mind that I should try to let it rotate incrementally by setting sprite.children[0].rotation += 0.1 but that sprite never rotates completely. It onl wiggles a little to the left and then a little to the right. All other sprites are really rotating, except that one. As I don't even have a clue what could cause this issue, I hope some can help me out. Unfortunately I could not reproduce that problem with the sandbox here. var parent = game.add.sprite(0, 0, 'parent'); parent.anchor.set(0.5); var child1 = game.add.sprite(0, 0, 'child'); child1.anchor.set(0.5); child1.scale.setTo(.5); setMinMaxScaleToOwnScale(child1); child1.x = newPosX; child1.y = newPosY; parent.addChild(child1); This is the routine I use for all the sprites which are attached to the parent. As I said, every sprite behaves correctly except that one sprite. Someone got any ideas on that issue? Appreciate your answers Edit: It seems like the children are trying to scale when the parent or themselves are rotating. That's awkward.
  6. Alright. I agree with that. I had to do some face detection stuff with JavaFX and it was awful. So I used a C++ port to do the my job.
  7. Awesome. I'm gonna have a look at that. But for now I guess I will just wait until v2 is out because it doesn't make that much sense to work on something that is called to be dead soon (v1.5). It's a little ago I worked with Java. I did not hear that JavaFX is out of date (since you want to replace it?).
  8. Hi, I decided to take kinematic scrolling which was developed by a user here. However, I found a way to tell the editor to take JavaScript 6, but Im not sure how to install it (taking the libs into the editor). As the project is, meanwhile, too big, I will stick to JS5. Edit: Is there a way to contribute to the Phaser Editor? Wouldn't it be awesome to be able to configure the physics in the canvas or something like that (collision detection: category bits, mask bits, category group)?
  9. Oops, for the position I got the following solution: I've set the anchor to 0.5 for all and reset the position based on the centerX and centerY. But I still couldn't figure out the problem with the scale. Edit: Alright. Everything is cleared up. This example helped me: Limiting scale
  10. Hi, I got a sprite who got some anchor points for dynamically attaching other sprites to it. As the complete sprite (with its children) will be moved along a path while rotation and stuff like that, I prefer using a single sprite and attaching the sprites to the parent sprite instead of using groups. However, I do not understand how the position of the children is related to the parent. The goal is, obviously, to put the children to their according anchor points of the parent. The anchor points' positions are relative to the parent, for example {x: 70, y:0}. When I just say var parent = game.add.sprite(...); var anchorPoint1 = getAnchorPoint(1); var child1 = game.add.sprite(...); child1.x = anchorPoint1.x; child1.y = anchorPoint1.y; parent.addChild(child1); I would expect, that the child1 sprite would have the position {x:70, y:0) relative to the parent sprite. But instead, it seems like the position something else. I couldnt figure out what's effecting the position. Somebody knows that? Furthermore, the parent got a scale factor of {x: 0.5, y:0.5} and the child1 sprite too like {x:0.9, y:0.9}. When adding the child1 to the parent, the child1 sprite is much much smaller than it actually should be. Is the child1 scale factor influenced by the parent scale? How can I reset the child1 so that it fit its own scale?
  11. I hoped there is already something implemented like a PathFollower or something similar to that. Thanks for the link. I learned interpolation algorithms in school but I wanted to avoid to implement my own solution to spend time. Enjoy your day.
  12. Hi, I'm recording a sprite's position over time and store the values in a json object. The user can move around the sprite to wherever he wants. What I wanna do right now, is "replaying". So to say, I want the sprite to follow the path which is defined in the json object. Is there a way to do so without using thousands of tweens? When using tweens, the duration is not correct (e.g. I set 200ms and in reality the tweens takes like 500ms). I wanna achieve a 1:1 time replay. Thanks in advance.
  13. So still no solution to the problem and it seems like the problem cannot be fixed. The backgrounds are the main issues, having 3 layers and rendering them are causing the issue, although I created a chunk system (so I'm using sprites instead of tilesprites). As soon as the backgrounds needs to be rendered, the fps drops to 30. When they dont need to be rendered, the fps goes up to 60, even when CPU is throttled by 4 times.
  14. Hi, I'm using the Physics Editor to create shapes for my sprites. I reset the position for the bodies with sprite.body.x += sprite.width / 2; sprite.body.y += sprite.height / 2; to make the body fit the sprite and it works as expected. Unfortunately this doesn't work for TileSprites. It looks like, whenever I apply the above statements to a TileSprite, that the sprite and the body are moved, which is not what I'm going to achieve. How can I set the body of a TileSprite to the correct position again? Thanks in advance.
  15. I verified that box2d is not the issue in my game. It's more the amount of sprites being loaded (with textures and bodies). When I set generate=false for some groups of my canvas, the fps went from ~28 to ~58. The approach is now to have something like onOutOfCameraKill and onWithinCameraReset (as I need the body for collision checks). Thanks.