Laumark

Members
  • Content Count

    15
  • Joined

  • Last visited

About Laumark

  • Rank
    Member

Recent Profile Visitors

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

  1. Ah, when I created the rectangle I gave it a width of 0 and then it didn't increase when I added to its width. Sorry for the fluke
  2. It might just be me, being a bit slow tonight, but I'm having trouble updating the width of a rectangle. I was thinking it's something like someRect.width += someValue, but that doesn't seem to work. Can somebody help me out here?
  3. I'm doing a small animation test, and even the simplest animation seems to stutter? What am I doing wrong? Have a look here: http://christianlaumark.dk/Portfolio3/test2.html //Avatars var Container = PIXI.Container, loader = PIXI.loader, Rectangle = PIXI.Rectangle, Graphics = PIXI.Graphics, Sprite = PIXI.Sprite, resources = PIXI.loader.resources; //Setting the stage var stage = new Container(); var myView = document.getElementById('main'); var renderer = PIXI.autoDetectRenderer(window.innerWidth,window.innerHeight,myView); renderer.view.className = "rendererView"; document.body.appendChild(renderer.view); var wW = window.innerWidth; var wH = window.innerHeight; loader .add([ "images/portfoliozepper.png", "images/bg.png" ]) .load(setup); var dir = "right"; var bob = "up"; function setup() { console.log("starting setup"); bg = new Sprite(resources["images/bg.png"].texture); zep = new Sprite(resources["images/portfoliozepper.png"].texture); bg.position.set(wW/2,wH/2); bg.anchor.set(0.5,0.5); bg.scale.set(2,2); zep.position.set(100,wH/2); zep.anchor.set(0.5,0.5); zep.scale.set(-0.5,0.5); stage.addChild(bg,zep); state = idle; gameLoop(); } function gameLoop() { requestAnimationFrame(gameLoop); state(); renderer.render(stage); } function idle() { if (dir == "right") { if (zep.x < wW) { zep.x += 1.5; } else { dir = "left"; zep.scale.set(0.5,0.5); } } else if (dir == "left") { if (zep.x > 0) { zep.x -= 1.5; } else { zep.scale.set(-0.5,0.5); dir = "right"; } } if (bob == "up") { if (zep.y > wH/4) { zep.y -= 0.5; } else { bob = "down"; } } else if (bob == "down") { if (zep.y < (wH/2 + wH/4)) { zep.y += 0.5; } else { bob = "up"; } } }
  4. Cool, thanks. I will. Pixi doesn't have anything like that?
  5. I'm making a game with Asteroid like controls, but I'm in doubt about how to move the sprite in the direction it is facing. What's the easiest way to do this?
  6. Hey guys. For my mobile game I need to make part of the screen scrollable (The marked space in the picture). Does anyone have an idea on how to do that? Thanks in advance! scrollable
  7. Hi. I'm using the tink plugin for making a small mobile game. I'm using the pointer.x and pointer.y properties to check if some squares in an array are hit, and this works perfectly when I test it in my browser on my computer. However, when I test the same thing on my mobile browser I can't succesfully use pointer.x and pointer.y to register where I have tapped. It seems that it registers where I tapped last instead of where I am tapping? Does anyone know how to get the x and y coordinates of a finger tap at the moment of the tap? Hope somebody can help
  8. Hi. I'm using the tink plugin for making a small mobile game. I'm using the pointer.x and pointer.y properties to check if some squares in an array are hit, and this works perfectly when I test it in my browser on my computer. However, when I test the same thing on my mobile browser I can't succesfully use pointer.x and pointer.y to register where I have tapped. It seems that it registers where I tapped last instead of where I am tapping? Does anyone know how to get the x and y coordinates of a finger tap at the moment of the tap? Hope somebody can help
  9. Perfect! I'm going with the easiest way, where I just scale it and fit it. Just what I was looking for, thanks!
  10. Hi, I'm developing a small HTML5 game for mobile and tablet. I am not a very seasoned coder. so I hope somebody can help me out here. I want to make the game fit the screens of different mobile and tablet platforms. How do I do that the best? Here is a link to an early prototype of the game, without any attempt for it to be responsive http://christianlaumark.dk/codeShop/shopProto1_5.html. Thanks in advance!
  11. Ah, amazing! Just what I was looking for Thanks!
  12. Ok, thanks! But isn't there an easier way to handle clicking elements?
  13. Yeah, I'm in Safari.. It works fine in Chrome. But I need it to run on Safari on my phone as well, so is there a way I can make it do that? Also, can i check if a text element is clicked with just the pixi.js library?
  14. Hey, I need help from somebody who know tink.js. I'm making a small game in pixi.js where I'm also using the tink.js library. In their introduction they are telling me to use this function to do something on click: anySprite.press = () => { //Do something when the pointer presses the sprite }; But it just sends me an error in the console. The structure looks weird to me.. Can this be the right way to use it? I have a text, where I want something to happen when it is clicked, so I used t.makeInteractive(varD); And then in the play function varD.press = () => { console.log("pressed"); }; But it just returns [Error] SyntaxError: Unexpected token ')' What am I doing wrong? Also, is there an easier way to do something on click? Perhaps just using pixi.js without tink.js? Hope someone can help