Jump to content

Search the Community

Showing results for tags 'buttons'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 23 results

  1. This is my code right now to check if left or right mouse button is down: // Left button down app.stage.on("mousedown", function() { // code... }); // Right button down app.stage.on("rightdown", function() { // code... }); But it doesn't seems to be possible that both events happen at the same time. How would I check if both mouse buttons are pressed? Left and right.
  2. Hello, I`m just getting started with game development and I`m trying to make a copy of Tetris that can be played on mobile phone as well. I want to be able to move the blocks with left/right/up arrows(from keyboard) and with 3 buttons that are displayd on the screen. Here I`m declaring the buttons(inside create function): create: function(){ //.... rotate_bricks = this.add.button(350, 180, 'rotate-shape', Tetris.Blocks.rotate, this); left_arrow = this.add.button(345, 240, 'left-arrow', Tetris.Blocks.moveLeft, this); right_arrow = this.add.button(345, 300, 'right-arrow', Tetris.Blocks.moveRight, this); //... }, And here is the moveLeft function: Tetris.Blocks = { moveLeft: function(game) { let points = 0; /*make a local variable, if all of the 4 blocks can be moved 30 px left/right then move it, if some of them will get out of the box, then don`t move Test for all blocks available on the map */ for(let i = 0; i < Tetris.allBlocks.children.length; i++) { //test if blocks collide with each others for(let j =0 ; j < Tetris.allBlocks.children[i].children.length; j++) { if(!(Tetris.allBlocks.children[i].children[j].body.velocity.y === 0) || Tetris.allBlocks.children[i].children[j].body.y > 370) { if(Tetris.allBlocks.children[i].children[j].body.x - 30 > 0) { points++; } else { break; } } } } for(let i = 0; i < Tetris.allBlocks.children.length; i++) { //test if blocks collide with each others for(let j =0 ; j < Tetris.allBlocks.children[i].children.length; j++) { if(!(Tetris.allBlocks.children[i].children[j].body.velocity.y === 0) || Tetris.allBlocks.children[i].children[j].body.y > 370) { if(points === 4) { console.log(Tetris.allBlocks.children[i].children[j].body.x);//for test Tetris.allBlocks.children[i].children[j].body.x = Tetris.allBlocks.children[i].children[j].body.x - 30; console.log(Tetris.allBlocks.children[i].children[j].body.x); } else { break; } } } } console.log("moved left"); }, the problem is that the console.log function is executed but the position isn`t changed(I know it works because when I use the keyboard everything is fine, I call the same function) The variable Tetris.allBlocks is declared globally(inside Tetris.Game as: var Tetris.allBlocks = ...); What it`s wrong? I couldn`t find an answer online
  3. Hi, I'm working on creating interactive buttons which, when clicked, will set the colour of the player. I've managed to do this successfully, in Phaser 3, but the code is quite bulky and ugly looking. I've just been gathering what examples I can through the website, but I'm certain there must be a better way to do this. Here's what I've got: I think what I want to do is create a class for "smalltiles", but I'm not sure how the inheritance should work for using alongside Phaser 3. I've tried writing something like in several different ways, without success: Does anybody have any insight as to how I might be able to do this better? Thanks for the input in advance.
  4. Hi all, I've recently started a project that I gave myself to learn more about web based applications. I'm working on building character creation menu, (based on NITW by infinite fall), of which the design I had in mind would eventually look something like this: What I have so far is just a test of one of the sprites I put together: mae.mp4 The sprite is made using just one layer, at the moment. Essentially, while I don't think the concept is too difficult to put together, I'm having trouble finding examples of how to implement relevant sections of code using Phaser 3. If you might be able to give me some examples or resources to look into as to how I could build some of the features, I would greatly appreciate that. So, examples/tutorials/advice I'm looking for regards: -Building multiple menus of images, each accessible by clicking on relevant category titles. -Building one specific menu which gives options for choosing your starting sprite. (Will be cat/alligator/dog etc) -Clicking on images in a certain feature menu triggering that image to be layered onto the sprite. (Where only one of each category can be equipped at any one time) -How to tint the colour of the sprite and clothing objects. (I think layering of facial features may be necessary here, so I may have to restructure my sprite sheet? How does layering work in Phaser 3?) Thanks for having a look, hopefully gathering some examples in one place will help the next person trying to make a similar game too.
  5. Hi, I'm a relative noob to javascript and Phaser, and I'm having an issue coding my first proper game. I'm using Phaser version 2.6.2 and the latest version of Chrome browser. I'm asking the user a basic maths question, but when I draw the buttons for the user to click they appear but aren't clickable. Here is the console error: And here is the code I believe to be causing the error: game.add.button(50, 250 + i * 75, "buttons", this.checkAnswer).frame = i; And there is also this bit of code to draw the button mask: this.buttonMask = game.add.graphics(50, 250); this.buttonMask.beginFill(0xffffff); this.buttonMask.drawRect(0, 0, 400, 200); this.buttonMask.endFill(); numberTimer.mask = this.buttonMask; Any help would be appreciated, if you need any extra information to help me I'll gladly provide it. Been staring at this problem for over a week and I just can't figure out what's wrong, I hope it's something simple I'm doing wrong. Thanks
  6. Hello, For a game, I need to make a 8 * 10 grid with buttons as follow : var counter = 0; for (var i = 0; i < 8; i++) { for (var j = 0; j < 10; j++) { this.btnNumbers[counter] = this.game.add.button(50 * j, 50 * i, 'check-box-rounded', this.onNumberTicked, this); counter++; } } The "onNumberTicked" event add a sprite over the button to make it feel as "checked" (I don't use buttons frames for that because I need to overlay a bigger image over a text centered on the button). My probleme, is that with about 10 buttons, onNumberTicked is called quickly, but when I add 80 buttons, I notice a big delay, maybe about ~500 ms. Is there a solution to solve this issue ? Thank you for you replies, Vince
  7. Using Phaser 2.6.2 with Safari on an iPhone, game loads up fine and seems to be running ok but can't get any response out of the buttons.
  8. Hi all! My geme have a menu_1 with buttons, if you click some button, then over an old menu_1 creates a new menu_2 with new buttons, but buttons from menu_1 react for click even if it under of new menu_2. I mean, if my button have observable PointerUp and I am creates sprite over this button, then this button react for PointerUp anyway, even under sprite, how I can hide all Observable buttons under one big sprite, that it don't react for pointer, but when I am delete my big sprite, then buttons start react on poiter again? Thank
  9. How can I create start menu in Phaser? I found nothing on that.
  10. Hi, I implemented a two finger zoom using the game.camera.scale propierty to zoom the game. I also implemented a drag functionality using game.camera.x and game.camera.y propierties. But now I need to add static floating sprites, such that they are always in the same position on the screen regardless the zoom or the drag movement. But when I add them as sprites (game.add.sprite) they are affected by the camera propierties (x,y,scale). I read this and set fixedToCamera to true, it works partially, the (x,y) is static, but the when I zoom in (increase game.camera.scale) the size of the floating sprites also increases. Is there any way I could add sprites that are not dependent on the camera? Thanks!
  11. Continuation of my Phaser game that I've been working on for the last few months. Working on a menu system now and trying to polish up the buttons with a hover state. I based my button code off of the example from Phaser. My issue stems from it doesn't work as it should. Right now it doesn't do any hover over change unless you hold down the mouse button and then move your mouse off and on the button. So rather than being able to change between the over and out images and then on click images it currently only has a change for on click and if you hold down the mouse button on a button and move the cursor out and over the button it changes.I know it is super wordy but I don't know how else to explain it. Here is my code: var newgameButton; this.newgameButton = this.game.add.button(50, 50, 'NewGame', this.newGameOnClick, this, 1, 0, 2); this.newgameButton.onInputOver.add(this.over, this); this.newgameButton.onInputOut.add(this.out, this); this.newgameButton.onInputUp.add(this.up, this); up: function() { console.log('button up', arguments); }, over: function() { console.log('button over'); }, out: function() { console.log('button out'); }, newGameOnClick: function() { this.game.state.start('LevelTut'); },
  12. I want to add controls like buttons and range sliders into the babylon.js scene. I am making an interior scene of a room. Can anyone share a link or page where i can find any info about that.
  13. Is there a way to see the full list of keyboard buttons? For example Phaser.Keyboard.SPACEBAR, Phaser.Keyboard.ONE, Phaser.Keyboard.TWO etc... I cannot see these "constants" in the phaser 2.2.2 docs. For example I need dot, single quote, dash(minus), ~
  14. Hey, I have an interesting problem where in one game state (Menu) I have a button that moves me to another state (PlayState). I have many buttons in the state PlayState. For some reason, ALL of the buttons in my second state are 'clicked' when I click the first button, in the first state, before the rest of the buttons even exist. Even when the callBack function I pass to the buttons are different, they are still invoked. I have tried several approaches with no success. Here is the code for the first state. Full code can be found at: https://github.com/HawpT/BrainFloss/blob/master/Game/js/Menu.js //the first button in the Menu state var newButton = this.game.add.button(400, 300, 'ball', this.clicked, this); //the callback function for that button clicked: function () { this.game.state.start('PlayState'); } The Second State code: https://github.com/HawpT/BrainFloss/blob/master/Game/js/PlayState.js LabelButton is just a wrapper that lets me print text on my buttons that I found on this forum. //one of the buttons from the second game state onebutton = new LabelButton(soccer.game,30,570,'numbutton','1',this.actionOnClicked,this,0,0,0,0); //its call back function, blank right now actionOnClicked: function() {} //and its input up handler, which is invoked whenever the button from the first state is pushed onebutton.onInputUpHandler(this.clicked(onebutton),this); clicked: function(b) { switch(b) { case onebutton: answer += '1'; break; case twobutton: answer += '2'; break; case threebutton: answer += '3'; break; case fourbutton: answer += '4'; break; case fivebutton: answer += '5'; break; case sixbutton: answer += '6'; break; case sevenbutton: answer += '7'; break; case eightbutton: answer += '8'; break; case ninebutton: answer += '9'; break; case zerobutton: answer += '0'; break; } this.game.add.text(0,0,answer,{font: '32px Arial', fill: '#000'}); } Here is an image of my first state, in which the soccerball is the button. When the soccer ball is clicked, it takes me to my second state, here: As you can see, there is a '1' printed in the top left corner as soon as I enter this state. No buttons have been clicked. I am new to JS and Phaser, but I have worked a little with action script in the past and never run across anything like this. Any help would be much appreciated.
  15. Hi, This works when I run it in cordova: game.input.onUp.add(jump, this); However this doesn't: enPlayButton.onInputDown.muff.add(PlayFunction, this); And when I change it to use the first example, like so: enPlayButton.input.onUp.add(PlayFunction, this); It still won't work.. Does anyone know why? Here is the full code if you need it: http://pastebin.com/UyPh1U9F First example is on line 1728. Second example is on line 554.
  16. Hello everyone !!!! I got the Xbox controller to work on my game but I cant make the RT button work. Is there any way to do that?
  17. I am having issues getting the click events to fire for a basic Phaser.Button when running in canvas+ with cocoonJS. I am testing the app (using phaser v2.2.2) with the cocoonJS launcher (using cocoonJS v2.1.1.1) on iOS 8.1.2 on an iPhone 6. Here is what I have on a basic menu game state: var button = this.game.add.button(this.game.world.centerX - 100, 215, 'assets', null, this, 'button_play_02.png', 'button_play_01.png', 'button_play_02.png', 'button_play_01.png');button.inputEnabled = true;button.fixedToCamera = true;button.smoothed = false;button.events.onInputOut.add(function() { console.log('button event onInputOut');}, this);button.events.onInputDown.add(function() { console.log('button event onInputDown');}, this);The button image displays in canvas+ but does not fire anything when clicked/touched. In webview+ and webview it works fine. The 'assets' is a texture atlas with the images being displayed for the buttons based on transparent pngs. I have seen similar issue on other topics (see below) but found no solution that worked. Any help would be greatly appreciated. Related topics: http://www.html5gamedevs.com/topic/3980-common-phaser-cocoonjs-issues/page-13 http://www.html5gamedevs.com/topic/7167-conoonjsphaser-buttons-dont-work-even-with-canvas/
  18. Hi I am currently working on a game using phaser but having problems where I want to display a button that you click once to start charging a power bar and then click again to set the power but once you do this the button should hide until the item being launched comes to rest for you to then repeat the process as needed. I have tried using button.visible = false, but nothing appears to change and outputting the value to the console shows it is false. Thanks in advance for any help
  19. I have the problem with the buttons even in CANVAS mode. Here is my game var game = new Phaser.Game(width,height, Phaser.CANVAS, 'game'); And the buttons for (var i = 0; i < 6; i++) { if(i%2==0) { this.button = this.add.button((25+90*i), (600), 'buttons', this.actionOnClick, this, 0); // this.button.anchor.setTo(-0.8, 0); } else { this.button = this.add.button((25+90*(i-1)), (785), 'buttons', this.actionOnClick, this, 0); } this.ans_text = this.add.bitmapText(60, -55, 'kuku', this.ans_style, 65); // bmpText = this.add.bitmapText this.button.addChild(this.ans_text); this.all_buttons.add(this.button); } And the Listener // what happens when i click the button actionOnClick: function (button) { var log; if(button.value==this.char_bubble.char_trans) { // right blocksound.play(); button.frame=1;} Nothing happens. I tried to switch of OpenGL on Cocoonjs launcher I use Cocoonjs 2.0.1 and phaser 2.0.4 Any suggestions?
  20. Hi! this is my first post on this forum I want to add static floating images on the Screen as a button Background scrolls but buttons remain fixed at their on position I want to use these buttons as input to the game The game i'm making with phaser is like platform game where platform runs but buttons remain fixed Thanks in advance sorry for poor English : )
  21. Hi all, I'm looking for a way to group buttons so I can animate between them. For example I have 15 levels in my game split between 3 worlds so 5 levels per world. I want to show buttons to these levels with 5 on the screen at one time, when the user clicks an arrow, the first 5 buttons slide left off screen and the next 5 slide in from the right. I initially thought of adding buttons to a group much like you do with sprites, then animating the groups on/off screen but it doesn't seem as though I can do this. What would be the correct way of doing this? Thanks, Martin
  22. As you can see here : http://test.xapient.net/phaser/touch.html i managed to make a virtual gamecontroller with gamecontroller.js (source: https://github.com/austinhallock/html5-virtual-game-controller ) the problem with this is.. its horribly slow.. the joystick is the slowest so i use the dpad but for some reason the whole game get's even slower on every restart (if you die for example and respawn - game is a 3rd slower - die again - game slows down again) furthermore it seems like an unwanted overload if you can implement nice buttons with phaser quckly.. so i made these: http://test.xapient.net/phaser/ unfortunately you can click on them with a mouse.. but no touch them.. i do not want to set a function that is triggered on touch because for my purpose i have to ask for the state.. i need something like pseudo: if (buttonLeft.isDown) { left = true; } else { left = false;} if (buttonRight.isDown) { right = true; } else { right = false;}i read through other posts and the docs for hours but i can't figure it out.. so help would be very much appreciated thx!
  23. Hi, I want to create an animated button, how can i do it? Can i set some animations on the over, up and active states of the button? Thank you
×
×
  • Create New...