# CodedGames

Members

31

• Rank

## Contact Methods

• Website URL
http://www.codedgames.com
@CodedGames

## Profile Information

• Gender
Male
• Location
Lakewood
• Interests
Coding, writing blog posts, other game dev things.

## Recent Profile Visitors

1008 profile views

1. ## Changing game.world.angle doesn't affect Arcade bodies.

So I'm trying to rotate everything using game.world.angle. I thought I would still be able to use the arcade physics system because, even though things are rotating, the underlying coordinate system is never changed. But, as you can see, when I rotate the entire world, arcade bodies remain unchanged. Any idea to get around this other than switch over to the P2 physics system? Update: So I found that the body.rotation variable is changing. I think that is the problem
2. ## phaser Move camera without bounds

So this seems like it should be fairly simple, I want the camera to always follow the player even if they go outside the bounds of the map. How would I do that?
3. ## phaser Rotating walls around the player.

Ok thanks guys I got things fixed. The problem was that I calculated the distance between two points, adjusted the x position, then calculated the distance again when adjusting the y position. This caused things to have their distance from the pivot point changed when it shouldn't. The only thing left is I need to get collisions to work with rotated sprites. Originally I was using the arcade physics but I heard I need to switch over to P2 for rotation to work.
4. ## phaser Rotating walls around the player.

Hello, so I'm trying to make it so that the player can 'rotate' the camera around them. For example when they press E and Q the world rotates and things like walls get repositioned and their angle changes. Here is the code I have written: function rotateWorld(angle) { for (var i = 0; i < walls.getAll().length; i++) { var wall = walls.getAll()[i]; wall.angle += angle; var delta_x = wall.x - player.x; var delta_y = wall.y - player.y; var thetaAngle = Math.atan2(delta_y, delta_x) * 180 / Math.PI; wall.x = player.x + lengthdir_x(distance(wall.x, player.x, wall.y, player.y), thetaAngle + angle); wall.y = player.y + lengthdir_y(distance(wall.x, player.x, wall.y, player.y), thetaAngle + angle); } } function lengthdir_x(length, direction) { return Math.cos(direction * Math.PI / 180) * length; } function lengthdir_y(length, direction) { return Math.sin(direction * Math.PI / 180) * length; } function distance(x1, x2, y1, y2) { return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); } So far this sort of works but objects lose proper positioning after rotating a bit. It seems like they are not rotating around a perfect circle. Any help would really be appreciated and if there is a way to do this that's easier please let me know. Thanks!
5. ## New to Phaser, trying to break the player into it's own class.

Ok awesome, the game will now run. That got rid of that error message. The only problem I'm running into now is that the player is not showing up in the game. Is that valid to call game.add.sprite(this); in the constructor of player? The object is getting instantiated, I can see that it is in the proper position using console.log but it doesn't seem to be affected by gravity and cannot move around. The sprite itself is also not being drawn. Edit: Got it, you have to call game.add.existing instead of sprite.
6. ## New to Phaser, trying to break the player into it's own class.

So I went through the basic platformer tutorial and one thing I don't like is that everything is thrown into the create an update methods. I'd like to clean that up a bit by breaking the player into it's own class: /** * Created by Robert on 1/4/18. */ /** * Create the game and define the size of the window. * * Phase.AUTO will use WebGL if the browser supports it * otherwise uses HTML5 canvas. * * @type {Phaser.Game} */ var game = new Phaser.Game(800, 600, Phaser.AUTO); /** * Create the game state. * * Preload: Where you load assets. * * Create: Called once at start. * * Update: Called every frame. * * @type {{preload: GameState.preload, create: GameState.create, update: GameState.update}} */ var GameState = { preload: function () { game.load.image('sky', 'assets/sky.png'); game.load.image('ground', 'assets/platform.png'); game.load.image('star', 'assets/star.png'); game.load.spritesheet('dude', 'assets/dude.png', 32, 48); }, create: function () { game.physics.startSystem(Phaser.Physics.ARCADE); game.add.sprite(0, 0, 'sky'); platforms = game.add.group(); platforms.enableBody = true; var ground = platforms.create(0, game.world.height - 64, 'ground'); ground.scale.setTo(2, 2); ground.body.immovable = true; var ledge = platforms.create(400, 400, 'ground'); ledge.body.immovable = true; ledge = platforms.create(0, 50, 'ground'); ledge.body.immovable = true; /** * Create the player. */ player = new Player(game, 32, game.world.height - 150, 'dude', 0); }, update: function () { var hitPlatform = game.physics.arcade.collide(player, platforms); player.update(hitPlatform); } }; game.state.add('GameState', GameState); game.state.start('GameState'); class Player extends Phaser.Sprite { constructor(game, x, y, sprite, frame) { super(game, x, y, sprite, frame); game.add.sprite(this); game.physics.arcade.enable(this); this.body.bounce.y = 0.2; this.body.gravity.y = 300; this.collideWorldBounds = true; this.animations.add('left', [0, 1, 2, 3], 10, true); this.animations.add('right', [5, 6, 7, 8], 10, true); this.cursors = game.input.keyboard.createCursorKeys(); } update(hitPlatform) { this.velocity.x = 0; if (this.cursors.left.isDown) { this.body.velocity.x = -150; this.animations.play('left'); } else if (this.cursors.right.isDown) { this.body.velocity.x = 150; this.animations.play('right'); } else { this.animations.stop(); this.frame = 4; } if (this.cursors.up.isDown && this.body.touching.down && hitPlatform) { this.body.velocity.y = -350; } } } Here is my code, I keep getting an error saying: TypeError: undefined is not an object (evaluating 'this.velocity.x = 0') for the first line of Player's update method. I'm not seeing what is wrong here. Any help would be really appreciated.
7. ## Looking for ways to improve

Thanks for the suggestions! I realize my tutorials have always been rather wordy and it is definitely something that I will improve in future games. As for graphics there really isn't too much I can do about that. I don't create my own graphics and don't have much of a budget to hire someone. As for your final suggestion "make the games easier to play on desktop browsers," I'm not exactly sure what you mean by this. What game did you have difficulty playing? Another thing I've considered is just putting my games out there even if licenses aren't that much. I'm not a full time game developer and I'm wondering if I'll make more money selling many low-cost licenses over just a couple high-cost ones. This would apply mostly to my older games that the big publishers are not interested in. I'm not planning on my games becoming my full time job as I'm still in college and don't have a ton of free time to work on this. I honestly just have a lot of fun making games and making money from them is just a bonus.
8. ## Looking for ways to improve

Hey guys, I don't post here all that much but I've been making HTML5 games on and off for around the last 3 years. In that time, I've produced 5 games that I feel are fairly high quality. I'm looking for suggestions on how to improve my games and monetize them best. I've done the usual steps, emailed publishers looking for non-exclusive licenses and have sold a couple. Right now I feel like I'm sort of in a rut where I've contacted everyone on my mailing list and don't know what to do from there. I've gotten many offers for revenue shares but have turned all of them down as I've never found them to work in the past. I've considered listing my games on websites like MarketJS, FGL, Clay.io and possibly the Evato Market, do these websites work well? Anyways, here is the webpage with all of my games: http://codedgames.com/buy-html5-games/ Any suggestions would be greatly appreciated.
9. ## iOS 10 Beta 2 causing strange rainbow graphics

So I noticed that since updating to iOS 10 Beta 2 my HTML5 games get this strange graphical bug that weirds out the colors wherever transparent/partially transparent pixels would be. Anyone have an idea of what would be causing this or do you think it's just a bug in iOS that will (hopefully) be fixed? I make all of my games in GameMaker Studio.
10. ## DRAW!! - Western Themed Card Game

Description: DRAW!! is an western themed card game where you are tasked with building different decks to defeat the many different outlaws! Each enemy has unique decks and mechanics so you must construct your deck to capitalize on their weaknesses. Features: 10 different Outlaws to battle. 16 unique cards to collect. Thousands of deck combinations! What still needs to be done: The game is completely finished other than that it needs music and sound effects. Since those are not vital to the gameplay I thought that it was a good time to post about it and get some feedback. Play in your browser: www.codedgames.com/games/draw Any feedback would be greatly appreciated.

Yes, I did.
12. ## Mysterious things that cause games to not work

I found the problem. Like Antriel suggested, I asked for a URL, immediately opened the console and found a few 404 errors.
13. ## Mysterious things that cause games to not work

I did, they said there wasn't which is very strange. That's the whole reason I made this topic.
14. ## Mysterious things that cause games to not work

What do you mean localization stuff because that potentially could be a problem. Could you go into a bit more detail about that?
15. ## Mysterious things that cause games to not work

Hey guys, So I'm in the process of selling one of my games; I got everything working in Chrome, Safari, Opera, IE, Edge, Firefox, Android Browser, Safari on iOS, and the company's own game runner. Sounds like everything is good right? I even set my Android VM to the lowest possible specs when trying their game runner. My game still ran fine. Well I send my game to the company and they say that the game never starts with screenshots of a blank screen. I ask them if they get any error messages in the console and they say they got none. So do you guys have any idea of what mysterious things could cause a game to work fine for me but not for them? Any help is really appreciated.