Jump to content

Unresolved problems this week


Woff
 Share

Recommended Posts

Hello gentlemen, last week between work and household chores I was working on my game. With your help and with google I've solved many tasks, but now it's already Sunday, but I've got some unresolved tasks, here they are:
 

1. My actual game world size is 1920 * 800, but if I try to make it (for example 3000 * 1200), he is still 1920.. :(
Here is something about my game's width and height:

var game = new Phaser.Game(1200, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
game.world.setBounds(0, 0, 1920, 1200);
 

I'd like my game world woud be wider

2. When I add some sprite, and sett it's size, everything looks good, but if sprite is not rectangular, how can I remove the empty spaces and set form to it (screenshot bellow) ?

A short description of the picture: the user is on the bus, but it looks as if he is floating in the air


Hope I described all clear

post-10454-0-20689800-1411908820.png

Link to comment
Share on other sites

Regarding #2

I bet you're using phaser's arcade physics engine and not P2. This engine only supports AABB collisions, which hare collisions between full rectangles. There is no support for polygons, which your car needs so your character is not floating above.

 

Look at the following P2 example, which nicely shows images with polygons instead of rectangles as their physical shape.

http://examples.phaser.io/_site/view_full.html?d=p2%20physics&f=body+debug.js&t=body%20debug

Link to comment
Share on other sites

One of the most used tools is PhysicsEditor (https://www.codeandweb.com/physicseditor). Use the format Lime + Corona (JSON) to export your files.

 

There is also a plugin for Phaser which you can use to export polygons with some advanced settings (naming, sensors, bitmasks). The folder "resources/PhysicsEditor Exporter" in the phaser download is the plugin. Search the forum in case you want to install it someday.

 

Forgive me for overseeing linux. I do not know about available exporters for that platform.

 

 

game.physics.startSystem(Phaser.Physics.P2JS) only prepares and starts the physics system so you can use it. Look again at the example, there you will find the line

game.physics.p2.enable([ contra, bunny ], true);

This is how you enable specific objects to be part of the physics world. I think you should browse the p2 examples to get a feeling for P2 and then search the forum for more advanced examples like the ones you have already mentioned above.

 

Have fun!

Regards George

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...