Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

9 years ago by ryananger

Hey all!

I'm working on a TBS and I'm in the process of working on character placement at the beginning of the game.

I ran into some issues with ig.input.pressed, but found what appears to be a pretty gross work around.

I was hoping someone would be able to tell me how to do this better. It works, but I feel like there must be a more simple way to do it.

Also, this is supposed to be a multiplayer game. How early in development should I implement multiplayer? Can I program all the gameplay and do the multiplayer after without too much adjustment?

Any help would be greatly appreciated!

https://gist.github.com/anonymous/b4b7af0223534cf01c3f

http://illustronomer.com/tbs1/

(Click on characters to place them somewhere, use WASD to set facing direction.)

9 years ago by Joncom

How early in development should I implement multiplayer? Can I program all the gameplay and do the multiplayer after without too much adjustment?
One approach is you could build your game without multiplayer, then build some other simple game with multiplayer (to learn how it's done), and then come back to your original game and modify it to have multiplayer. This separates "learning to make a game", and "learning to network a game" into two different projects, which may be more manageable.

Edit: Your gist link appears to be broken.

9 years ago by ryananger

Thanks Joncom. Maybe I'll make a multiplayer chess clone to figure out the networking.

Also, I fixed the gitlink.

9 years ago by ryananger

So I'm trying to figure out a way to change an entities animation on update. Basically, I'm pulling stat information from whichever unit is currently active, and I need the activePanel to change frames to match the art of the activeUnit (type and color).

All of the stats are being loaded properly, so I just need a way to update the animation.

EntityActivePanel = ig.Entity.extend({
		animSheet: new ig.AnimationSheet ('media/sprites1.png',50,50),
		size: {x: 50, y: 60},
		stats: 0,

		init: function (x,y) {

			this.addAnim('base', 1, [2]);
			this.currentAnim = this.anims.base;

			this.parent(x,y);

		},

		update: function () {

			if (ig.game.activeUnit != 0) {
				this.stats = ig.game.activeUnit;
			}
			else {
				this.stats = 0;
			}

			if (this.stats != 0) {
				var q = this.stats.type*4,
					r = this.stats.color*12;

				this.anims.base.gotoFrame(q+r+2);
				
				console.log(this.anims.base)	
				console.log(this.stats)
			}
			
			this.parent();
		}
	});

9 years ago by ryananger

Figured it out. Used the Image draw Tile function to get what I wanted, seen here:

EntityActivePanel = ig.Entity.extend({
		sheet: new ig.Image ('media/sprites1.png'),
		font: new ig.Font( 'media/04b03.font.png' ),

		size: {x: 60, y: 60},
		stats: 0,

		init: function (x,y) {

			this.parent(x,y);

		},

		update: function () {

			this.parent();

			if (ig.game.activeUnit != 0) {
				this.stats = ig.game.activeUnit;
			}
			else {
				this.stats = 0;
			}
		},

		draw: function () {
			this.parent();

			if (this.stats != 0) {
				var q = this.stats.type*4,
					r = this.stats.color*12;

		    	this.sheet.drawTile(65,5,q+r+62,50);

		    	this.font.draw(this.stats.name, 125, 20);
		    	this.font.draw(this.stats.HP, 125, 30);
		    	this.font.draw(this.stats.MP, 125, 40);
			};				
		}
	});

http://illustronomer.com/tbs1/

9 years ago by Joncom

Hurray for answering your own question! Haha

9 years ago by ryananger

Haha yeah. Figured I'd post the solution in case anyone else ever has the same issue.

9 years ago by Joncom

Quote from ryananger
Figured I'd post the solution in case anyone else ever has the same issue.
Good idea :)
Page 1 of 1
« first « previous next › last »