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

1 decade ago by mpalla

Hey everybody, I'm completely new to this game making business, but I'm working on my final project for my new media class and I've hit a roadblock already and can foresee several more up ahead. I might be using this thread for a bit of workflow as well as getting any helpful input to the successful completion of my game.

The first problem I've hit is most likely a simple one and I'm missing where it is in the Docs, but I'm currently stuck trying to make my player entity jump, and also to have it jump while running forward. Like I said, simple.

After that I think I might want to incorporate a biting action for when it picks up items, but have it bite regardless of the sprite image it is currently on; e.g. it can bite while running and also while idling. This is probably a simple fix too, but I'd rather not edit the entire running sequence to incorporate biting as well.

That's probably the most pressing of the issues I'll have with the entity at the moment, but a bigger deal is the problems I've been having with the background. I'm using one large image which is, when at full size, 1440 x 778 pixels and weltmeister refuses to turn it into comprehensive blocks when I decide to try it that way. Ideally I could just place the image as a background via coding rather than doing it by hand in weltmeister, but I'm not sure how that would be coded and if there is even a way of doing that.

Several other things aren't as difficult; I feel like sprite changes in the background for ambiance could be done via entities with collision masks overlaid, unless there is a simpler method. Pickup items, push-able blocks that sort of thing would all be entities as well, from what I understand, I just haven't gotten around to coding them yet.

What is going to take some doing is the main device controlling the game, which is a randomized timer that results in a game over screen ( a "crash") anywhere between thirty seconds to two minutes. This timer would work behind the scenes or be mirrored with an indirect translation in the game, such as a steadily rising counter. The same crashing element that would be controlled by the timer would also be present in the other entities in the game such as the push-able blocks and pickup items, but the chances of these items causing a crash would be based on percentage rather than the randomized timer. That or interacting with these items increases the timer by n, n being something like 5 percent, which in turn causes the likelihood of a crash to become more likely as the game progresses.

So yeah, there's that. I'm also wondering how an entity like the counter might be overlaid over the main action of the game, so it would stay in the upper left corner as the camera follows the player around the map.

If you guys can think of any solutions to any of the above, feel free to let me know, I'm going to pour over the Docs some more to see if I can find anything close to what I need. I'm sure more problems will arise, so I'm probably going to post my workflow as I go.

EDIT: Oh, another issued I'd like to fix is cutting off the running sequence when the trigger isn't being pressed. There's a bit of a delay going back to idle depending on where in the run cycle you take your finger off of the button, and I'd like to... fix that. Yeah.

1 decade ago by dominic

That's a lot of questions :) Have a look at the example games on your download page - these games already do some of the things you need.

To let an entity jump, you set the y velocity of this entity to a negative value, whenever the jump button is pressed. The player entity in the Jump'n'Run demo game does exactly this.

For item pickup, have a look at the entities check method. You can set up your item entities in a way that their check method will be called when they overlap with the player entity. You can then, in this method, give the player entity some health (or whatever your item is doing) and then kill() the item to remove it from the level.

For the background, it would probably be best to just draw it yourself and not have it as layer in your level. You can do so by loading the background as an ig.Image, overwriting the draw() method of your game class and draw the ig.Image there. E.g.:
MyGame = ig.Game.extend({
	// Set the clear color to null, so the call to this.parent()
	// in the draw() method won't clear the screen after you've
	// drawn the background image
	clearColor: null, 
	
	// load the background image
	background: new ig.Image('media/background.jpg'),
	
	…
	
	draw: function() {
		// Draw the background image at 0, 0
		this.background.draw(0,0);
		
		// Draw everything else
		this.parent();
	}
});

The counter you described isn't really an entity and shouldn't be implemented as one. Entities are objects in your game world that you (the player) can interact with.Typically you have your game class keeping track of things like the counter and also draw the "User Interface" overlay there. Just load a font and draw some text. See the Jump'n'Run example - it displays some text on screen that's in front of everything else.

Regarding the relay for you animations: there&039;s no need to wait till the animation has finished before switching to another one. As soon as the run button isn't held down anymore, you can set #this.currentAnim on your entity to the 'idle' animation.


Your questions are all a bit "vague", but I hope that helps a bit. Again, have a look at the demo games - specifically the Jump'n'Run example should be a good starting point.
Page 1 of 1
« first « previous next › last »