valueerror

Members
  • Content Count

    1096
  • Joined

  • Last visited

  • Days Won

    3

valueerror last won the day on February 11 2015

valueerror had the most liked content!

3 Followers

About valueerror

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    http://games.xapient.net/
  • Twitter
    xapientius

Profile Information

  • Gender
    Not Telling
  • Location
    Austria

Recent Profile Visitors

2337 profile views
  1. thank you very much for this explanaiton! i'd suggest Phaser3 as a name.. just because the name stands for a good and easy to use js gameframework.. a good brand should stick to it's name and logo ... have a look at this... they know why they are doing this ^^
  2. http://test.xapient.net/circleworld/ like this for example.. i used 4 polygons to round the edges and tiled map edior to paint those polygons...
  3. of course.. you just should keep track of your constraint.. usually i store the constraint directly on one of the constrained objects.. somesprite.constraint = game.physics.p2.createRevoluteConstraint(somesprite.body, [0,0], someothersprite.body, [0,0], 10000);then i delete it with: game.physics.p2.removeConstraint(somesprite.constraint);somesprite.constraint = null;you could also clear ALL constraints at once: function clearAllConstraints(){ var allConstraints = game.physics.p2.world.constraints.splice(0,game.physics.p2.world.constraints.length); if (allConstraints.length > 0){ for (i=0; i<=allConstraints.length; i++){ game.physics.p2.removeConstraint(allConstraints[i]);} }}note that i use a workaround to get all constraints because the last time i checked the "getConstraints()" function returned "undefined" (i already reported the bug so it's probably fixed by now)
  4. every p2 body gets a rectangular shape in the size of the image first.. until you call somesprite.body.setCircle(20); for example.. then the first shape gets replaced with a circle ;-) yanifska's way is perfect if you want to change the physics body anyway.. that way you can always access the playershape directly by its representation "playersensor" (for example) to acces the first shape of any body you could also do the following: somesprite.body.data.shapes[0].sensor = true;as you can see all shapes are stored in the body.data.shapes[] array
  5. hehe.. maybe.. btw. i posted this example because i used sensors of course.. but this is by far not the best way to accomplish what i actually wanted to do there.. (the jumpthrough platform) i managed to get it to work with a totally different approach... (just in case someone needs it ) http://www.html5gamedevs.com/topic/6148-the-moving-jumpthrough-platform-sum-up-thread-help-very-much-appreciated/?p=36930
  6. just configure the bullets to act as sensor.... they will not trigger a collision response but still report the collision.. so you could then change the health of the enemy and destroy the bullet but no physics response will occur !
  7. well.. collisiongroups shouldn't be a problem in general unless you would like to have different collisiongroups for different shapes... (what would be great but i guess that's just not possible right now - correct me if i'm wrong please) the function that is called on contact (either through a collisiongroup callback or an onbegincontact event) has to figure out which shape of the body reported the contact and then act on it accordingly.. should work!
  8. http://test.xapient.net/phaser/ALL/moving-jumpthrough-platform-2.html this is one of my first experiments to get jumpthrough platforms to work.. i used two sensors.. the above one disables collision on contact and the lower one enables it... maybe you could read the code and find out what you want ?
  9. if you want to create a "dust trail" particle emmiters are probably not such a bad idea.. you can define a particle emitter flow, give it a gravity, set it to scale over time and decrease the alpha value.. that way you will easily create something that looks like the smoke coming out of a combustion engine..
  10. for vertical walls i did the same thing.. i used a slightly altered version of the "checkifcanjump" function to figure out if the player is touchingLeft or touchingRight and if so i canceld the movement.. BUT.. this function would probably also prohibit climbing 45deg hills..
  11. ah.. ok thx.. i think i understand if the camera starts to pan it probably reached it's bounds and tries to stay within them ?! you could try.. game.camera.bounds = null; just to find out if the bounds are the reason? and if you decide to put up an example on the sandbox i'l definitely give it a try
  12. oh.. and another thing.. the easiest way of all ways to do this is to just zoom to the current center of the camera.. do not change the camera position at all.. the user can position the wanted object manually into the center of the curren view and just zoom in and then move the camera manually again if the wanted object is not exactly there.. that's totally usable and reliable
  13. oke.. some thoughts: first of all.. it shakes? there is easing activated in the current code so the zooming motion is smooth - this leads to a little overlap.. the camera should reposition itself but the easing function isn't quite at the target scale position.. so the easing is going to finish and afterwards the camera is repositioned.. it's way better with pinch to zoom but the only way (or better the easiest way) you can get rid of this is by removing the easing. set easing to 1 and this "shaking" (i believe i figured out what you mean by that) is gone.. # that leads me to the first thought: don't use easing and definitely don't use tweens! this just delays the userinput and leads to situations where the user triggers an action but the tween is still running.. also your functions will have to wait for the tween to finish or deal with a constantly changing variable.. further you will create a hundred tweens in a second with your mouswheel function and every tween will try to do it's part.. what if the user suddenly wants to scroll out but the scroll-in tween is still running? what if the second tween is started but the first is still running? and btw. because you are not reusing your tweens but creating new ones the garbage collegtor will have a lot of work to do - but that's probably a problem for the future # use: game.camera.view.centerX and you can get rid of your setCenter() function # basically you are centering the object all the time into the center of the camera by moving the object.. this seems to be very problematic.. what if the object is moving on its own? what if there are a hundred objects.. instead try to center the camera over the object(s) - your current code seems to try something completely different than just zoom in or out of your map. # instead of scaling the world you should think of scaling a group.. that way you can define a seperate group that will not zoom (for the UI for example) # what about creating a jsfiddle or a phaser sandbox with a working example where everyone can try your stuff and test with real code? BTW. if you remove the touchzoom from my example and add the necessary code to your example to compensate for the scaling factor there will be no difference in complexity ;-) but it's always a good thing to write your own solution - a solution you fully understand !
  14. @icp: this doesn't exactly answer the question.. i think boolean already figured out how to make them collide but is wondering why i have to set bodyA to collide with bodyB and vice versa.. if A collides with B the logical outcome would be that B also collides with A - so why the redundance.. IMHO the best approach would be to set it independently from the bodies like. phaser.pyhysics.p2.setCollisions(ArrayA, ArrayB); //pseudocode !! all collisiongroups in arrayA should collide with all collisiongroups in arrayB)
  15. http://jsfiddle.net/valueerror/pdx0px0w/ working code zoom in/out with mousewheel (it will zoom to the pointer) or with pinch2zoom (it will zoom to the center between your fingers)