Search the Community

Showing results for tags 'draggable entity'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 2 results

  1. hi all, its going well with melonjs in building of my game ... can someone help me how to disable the multi-touch form draggable entity . i am trying to releasePointerEvent while dragmove but like this me.input.releasePointerEvent("pointerdown",this); but i am failing to register my pointer down event again .. can some one help me with this .... here is my code for reference.. i am detecting collision also ...so the problem arise when i am dropping my asset on collision part(another asset) it will detect collision and it wont drop and my asset will follow the pointer till i drop it on non collision zone if instead of dropping if i am selecting other asset it selecting other asset also along with my previous asset then i cant drop both because its colliding with each other .. this is what happening i trying all ways but i am not getting it can someone suggest me how to handle this thank you game.mycopy = me.DraggableEntity.extend({ init: function (x, y, settings) { var image = settings.image; var framewidth = settings.width; var framewidth = settings.height; // console.log("Dragged !!!!!!!!!!!!!!!!!!!!!!!!"); this._super(me.DraggableEntity, "init", [x, y, settings]); console.log(camera); me.game.world.removeChild(camera); /* var texture = new me.video.renderer.Texture({ framewidth: 268, frameheight: 296 }, me.loader.getImage(image) ); // create a new animationSheet object this.renderable = texture.createAnimationFromName([0, 1, 2, 3, 4, 5, 6, 7]); // define a basic walking animation (using all frames) this.renderable.addAnimation("walk", [0, 1, 2, 3, 4, 5, 6, 7]); // define a standing animation (using the first frame) this.renderable.addAnimation("stand", [0]); // set the standing animation as default this.renderable.setCurrentAnimation("stand");*/ this.xcor = x; this.ycor = y; // this.anchorPoint.set(0, 0); this.isHoldable = false; this.hover = false; this.entityselected = false; var settle = {}; this.settle = settings; // console.log("settings" + JSON.stringify(settings)); }, update: function () { return true; }, //code for removing collision object onActivateEvent: function (event) { // register on the 'pointerdown' event me.input.registerPointerEvent('pointerdown', this, this.pointerSelect.bind(this)); }, pointerSelect: function (event) { if (event.button === 0) { console.log(this._super(me.DraggableEntity, "dragMove", [event])) console.log("this entity is selected"); console.log(this); /*this.oldx=this.pos.x; this.oldy=this.pos.y; this.oldrow=tile.row; this.oldcol=tile.col;*/ /* if(event.type == "mousedown" ){ //this.entityselected = false; $("#cbp-spmenu-s2").addClass("cbp-spmenu-open"); } */ this.isHoldable = true; this.hover = true; this.entityselected = true; this._super(me.DraggableEntity, "dragStart", [event]); if (me.levelDirector.getCurrentLevelId()) { var layer = me.game.world.getChildByName("ground")[0]; var tile = layer.getTile(event.gameX, event.gameY); if (tile) { return false; } else if (event.button === 2) { //right click console.log("right click"); $("#cbp-spmenu-s2").addClass("cbp-spmenu-open"); } else { //mouse wheel console.log("wheel click"); } } } // don"t propagate the event to other objects // return false; }, dragStart: function (event) { if (this.entityselected === true) { if (event.button === 2) { //right click console.log("right click"); $("#cbp-spmenu-s2").addClass("cbp-spmenu-open"); } else{ this._super(me.DraggableEntity, "dragStart", [event]); console.log("drag dragstart"); console.log(event); this.isHoldable = true; this.hover = true; this.entityselected = true; } } //return false; }, dragMove: function (event) { console.log("event" + event.type); // console.log("event" + event.type); if (this.entityselected === true) { // me.input.releasePointerEvent("pointerdown",this); ///////////trying to release Pointer event console.log(this) this.isHoldable = true; this.hover = true; this.entityselected = true; this._super(me.DraggableEntity, "dragMove", [event]); //me.game.viewport.follow(this.pos, me.game.viewport.AXIS.BOTH); me.collision.check(this) } //return false; }, dragEnd: function (event) { var x, y; if (this.entityselected === true) { if (me.levelDirector.getCurrentLevelId()) { var layer = me.game.world.getChildByName("ground")[0]; var tile = layer.getTile(event.gameX, event.gameY); if (tile) { if (me.collision.check(this) === false) { this._super(me.DraggableEntity, "dragEnd", [event]); console.log("drag end"); // me.input.registerPointerEvent('pointerdown', this, this.pointerSelect.bind(this)); x = this.pos.x; y = this.pos.y; this.isHoldable = false; this.hover = false; this.entityselected = false; } } } } me.collision.check(this); }, onCollision: function (response, other) { // Make all other objects solid return false; } });
  2. HI , can someone tell me how can I detect collision between two me.DraggableEntity entites. or detecting collision between two sprites when they are dragging and dropping on each other. we can detect the collision by using me.DroptargetEntity but when i make an entity as me.DroptargetEntity then i cant able to drag the same please help me with this Thank You