1 decade ago
by Yu
any example or coding for me to kick start my project?
You should look at the available source code in the Jump'N'Run demo from your download page.
Also if you're just starting out, it's a good idea to build a game on what you know first. This'll help get you familiar and opens up a window of opportunity for you to learn more.
for a tower defense game using mouse input, you have to develop a system where ALL relevant entities are clickable.
my initial thoughts:
Use the eventListener, and translate the mouse coordinates into the screen coordinates. If the mouse coordinates lands on the entity, you make that entity 'active'.
Upon clicking on a new position, kill the entity from its original position, and spawn the entity in the new position (no dragging effect, but it's a start ).
For dragging, you can 'snap' the entity to the mouse coordinate, which basically means updating the location of the entity with the mouse coordinates.
Think of it like a chess game, where you move the pieces with your mouse.
I'd say, making the entities clickable would be a great start. After that it's all smooth sailing, and you can make 2d scroller tower defenses, as well as top view ones.
my sources of inspiration
platformer: jump and run (dominic), dino needs love (gameJam), Twitapocalypse (dariusK)
shooter: P-Shooter (nefD)
2d rpg style : minidungeon (isowerk), zelda (8bit)
PS: you can find all of them in the Games section
1 decade ago
by Yu
after few day of testing I would now agree with Hareesun, although I've the game design of what kind of game I wanted to make; being an artist, I've limitation of coding especially from scratch.
Just a small snippet here, to know if the mouse is on the entity :
_mouseInsideEntity: function()
{
var mouseWorldX = ig.input.mouse.x+ ig.game.screen.x,
mouseWorldY = ig.input.mouse.y + ig.game.screen.y;
return mouseWorldX > this.pos.x &&
mouseWorldX < this.pos.x + this.size.x &&
mouseWorldY > this.pos.y &&
mouseWorldY < this.pos.y + this.size.y;
};
Page 1 of 1
« first
« previous
next ›
last »