Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by gregkarber

  1. I have made this game Lettuce Climb that procedurally generates a mountain for you to climb as a head of lettuce. However, I have persistently had an issue with the head of lettuce slipping 'between' two physics bodies. The bodies are generated randomly, and while I connect all the square ones to form one long rectangular P2 body, the triangular tiles are individual, separate P2 bodies. Frequently, when the player is falling, they will slip between this triangular body and the square body next to it. I have tried a number of solutions to fix this, including limiting the speed at
  2. Hello, all! I am a writer/director living in Los Angeles. A couple years ago, I started working on a simple procedurally-generated lettuce platformer in Phaser. You play as a head of lettuce trying to climb a mountain to reunite with your tortoise love. Since then, I have repeatedly been sidetracked by other projects and am now returning to it with the hopes of releasing it in the next month or so. You can play a demo of the game at http://gregkarber.com/lettuceclimb (but please do not share). As you can see, for a game that is this simple (about ~2500 lines of code), I have persiste
  3. I am trying to fix a problem with a circular body falling between rectangular bodies, so I was debugging it, and I noticed that my main sprite body looks like below (I have made the sprite itself invisible so that you can see the debug body). It seems that the radius in that image shows the actual boundary of the body, not the circle. Previously, when I've done this, the radius touches the edge of the circle. So, my question is, what is going on in this picture? What do the circle and the radius represent? I know this is a pretty fundamental thing, but I'm lost, so -- going forward -
  4. Through more testing, I've come to realize that the main lettuce sprite doesn't fall through the ground sprites, it falls between them. Is there anyway to avoid that?
  5. I'm working on a procedurally-generated mountain climbing game where you play as a head of lettuce. You can play the working demo here. I have a bunch of work to do regarding streamlining the code and the gameplay, but I can't seem to resolve a problem. When the head of lettuce falls from a substantial height, he falls through the black rectangle sprites I use for the ground. This means it falls through platforms. In addition, since the ground is only one physics-enabled sprite deep, if he falls through that, he falls through the world and the game is over.
  6. Oh man, the emitter thing. I'm sure that's it. Thank you very much! These were all great ideas, and thank you so much for the kind comments on the game itself. That's wonderful.
  7. I made a game called The Space Beyond and it starts out really fluid and smooth but if you play for a couple minutes the framerate drops and it gets really laggy. I'm already (1) killing and reseting the asteroids from a pool, (2) killing any asteroids that get too far away, and (3) there's never more than like 30 sprites at any given time. But still it goes so slow. I can't figure out why that is. I'm sure there's something I'm missing, but I am an amateur coder and don't really know what I'm doing. I have copy-pasted the complete code for the game below. If anybody could figure this ou
  8. I think I implemented your suggestion! It still could run a little faster, though... function circleCreate() { var circleSize = Math.random() * 50 + 60; asteroidCircle = game.add.bitmapData(100, 100, "asteroidBit", true); asteroidCircle.circle(50, 50, 50, "#FFFFFF") asteroidGroup = game.add.group(); asteroidGroup.createMultiple(100, asteroidCircle); }function asteroids(x, y) { //console.log("asteroid at " + x + "," + y); var circleSize = Math.random() * .5 + .5; asteroid = asteroidGroup.getFirstDead(); asteroid.reset(x,y); asteroid.anchor.x = .5; asteroid.anchor.y = .5; asteroid.scale.x = c
  9. And will I need to apply the P2 bodies each time I create one? I'm sorry to keep posting questions.
  10. Maybe it would be easier if I just created a circle graphic rather than drawing them with Graphics. I assumed that drawing them would be faster than displaying a .png, but maybe that's wrong.
  11. I'm pretty sure I know how to do that for sprites with images: asteroidGroup = game.add.group();asteroidGroup.createMultiple(200, "asteroid");But how do I do it with graphics? Do I need to use Bitmap Data? I haven't used that at all, but I'm studying up on it now. If anybody knows how to do this, it would be an enormous help for me. Thank you so much!
  12. I'm working on a game called "The Space Between" for a gamejam, and I have a problem with memory efficiency. I'm drawing asteroids as circles and destroying them when I don't need them, but it still starts to lag a bit as the game goes on. How can I make it faster and smoother? Here is a link to the game, and copy-pasted below is the part that deals with asteroid creation and, below that, the entire source code (all 382 lines of it). I don't really know anything about memory allocation, so I'm sure I'm making some pretty elementary errors. (Also, there's no loading screen yet, so give it
  13. My problem was the use of "scale" on the tilemap layer. I should have used setScale.
  14. I cannot for the life of me figure out why this isn't working. I keep going over it, and I know I'm missing something obvious. You can play it here to see what I'm talking about. Please help! var TILE = 64;var game = new Phaser.Game(8*TILE, 8*TILE, Phaser.AUTO, 'game_div');var game_what = {};game_what.main = function() { };game_what.main.prototype = { preload: function() { this.game.load.spritesheet('pengy', 'pengy.png', 16, 16); this.game.load.tilemap('map', 'world.csv', null, Phaser.Tilemap.CSV); this.game.load.image('tiles', 'terrain.png'); this.game.world.setBounds(0*TILE, 0*TILE, 8
  15. I couldn't get them to without killing them. I would love for someone to help with that. However, you just helped me figure out a huge thing. I have been loading individual square sprites, but almost 99% of them are columns. So I only loaded physics bodies on the top ones. However, I could massively reduce the number of sprites by making each sprite a column. So thanks!
  16. I tried writing a function that deletes sprites when they exit the camera viewpoint, thinking that outOfBoundsKill was where the problem was, but it still occurs. It seems like sprites summoned using .reset that have already been created and killed don't pull their bodies with them, and even if you enable the body again, nothing happens. **EDIT:** Based on this theory, I fixed it by adding sprite.body.destroy() before I killed each sprite. Is there some way to do that with sprite.outOfBoundsKill = true, but I couldn't figure it out.
  17. Thank you very much! I'm working on an implementation with sprites that are created on the edges and have .outOfBoundsKill = true. However, sprites that are created with this function don't seem to hold onto the physics bodies I'm trying to give them. Can anyone help? I posted a new thread about it here. I have become so frustrated with my own ignorance and inability. Coding's hard, y'all.
  18. I am working on an infinite climber of sorts, and I'm trying to create tiles on the side of the screen the player is going. However, if I enable .checkWorldBounds and .outOfBoundsKill, which is required for performance, the tiles that are created do not collide with my sprite. place_block: function(x,y) { x = x*TILE; y = y*TILE; var ground = this.platforms.getFirstDead(); ground.reset(x,y); game.physics.p2.enable(ground); ground.checkWorldBounds = true; ground.outOfBoundsKill = true; ground.body.static = true; ground.body.setMaterial(this.platformMaterial); },This all w
  19. EDIT: I have decided to load and delete sprites around the borders of the viewable space. However, I'm having problems implementing this, as well. Please help. I am working on a game where you play a head of lettuce that rolls, jumps, double-jumps, and wall-bounces up a procedurally generated cliff. I want this to go on for as long as possible, until you finally reach the top. The first two implementations I attempted were both fruitless. First I tried to make the whole thing as sprites. Then I tried to make the whole thing with tiles (using .putTile, as I describe below). Then I tried to
  20. I have been working on a casual game and am trying to make it possible for people to tweet and/or Facebook their score. I have accomplished this through the use of window.open and the intent link for Twitter and the sharer link for Facebook. This works absolutely fine on browsers, even on mobile. However, I want to encourage people to add the page to their iOS home screen, and if they do this, neither of these links work (because it's not in a browser, I assume). Is there an alternative way to do this? Or a way for an iOS device to trigger the Twitter and Facebook apps? Thank you very m
  21. I am not a coder (by any means), but I managed to cobble together this game based on a tortoise character in these daily koans that I write. You can play the game at koanoftheday.com/trails.
  22. Okay, more thoroughly useless investigation: I have found that the bottom of your playfield seems to be at about 150, that is, when the green dot is at the bottom of the square, the y location seems to be 150. Not sure if this helps!
  23. I just tried debugging it, and found that "head.x" did equal 255 when it said that the snake was dead, despite it not looking -- visually -- as if the sneak were at the edge. I also noticed that the snake can go well below the visual boundary before it says that the snake is dead. I am a rank amateur, so this is all I can say right now.
  24. I just re-tested it in Google Chrome, and now it's happening around the 950 step mark (or after about 300 sound-effect cues). I think the increase might have happened since I converted the sound files to lower-fidelity versions. And sometimes now it doesn't get distorted, it just decides to stop playing all-together. Once this happens, no sound effects work. I see some people include end-point parameters in their sound cues. Perhaps doing that will help? I honestly have no experience in audio programming and so do not even know where to begin. Is overlapping causing this kind of corruption?
  25. Oh, wow. I thought I'd tried it on a few people's computers in a few different browsers. May I ask what browser you're using?
  • Create New...