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

10 years ago by wingedwolf123

Hey Guys,

Well as title says I just bought impactjs loving it so far but still real new to js and programming with js,in general.. I've downloaded all the examples I have both books I could find on impact and several books on my tablet dedicated to js. . My question is I've had a hard time finding tutorials on both that are a little more in-depth.. so my question is does anyone happen to have a guide or a site that is little more in-depth on impact as in the syntax and why it's used.. so far with Jesse's book it's been a big help but I find it a little lacking in why I'm typing this code.. tho he does a code job I'd like to understand a little bit better.. thanx in advance guys

10 years ago by stahlmanDesign

If you are familiar with Javascript you probably aren't used to the syntax because everything in Impact is inside an object. Example:

Normally in Javascript you just create variables and functions in a .js file:
var myVar = 0;
function init() {
	console.log(myVar)
}

In Impact, everything is an object associated with an entity or plugin:
myVar: 0,
init: function(){
	console.log(this.myVar)
}

10 years ago by wingedwolf123

Yeah I have very little knowledge of javascript most of what I do know so far has been,with phaserjs. . I have a very basic knowledge of c++ and java which seems to help with the math parts. . Wrapping my head around the impact syntax is a little headache causing right now mostly because I'm completely new to it and html5 in general. .hope it gets easier and I plan on sticking with it

10 years ago by drhayes

I found the class reference a huge help when I was starting out. There aren't that many classes and it's worth reading straight through a couple of times. I've tried to read it with an eye towards my own games, like, "Oooh, an EntityPool, I could use that for particle effects," or, "Wow, background maps can animate?" That kind of thing.

I love JavaScript a lot but it has its downsides. JavaScript: The Good Parts is a great book if you're just starting out in JS.

The community here is very supportive for beginners and is happy to help, as well. What kind of questions do you have, specifically? Do you have a game in mind that you want to make?

My first piece of advice is there's no right way to do any of this. Seriously and for true, if how you're coding your game works for you then do that.

10 years ago by wingedwolf123

Alright thankyou for the advice I'll definitely check out the class reference tonight and checkout that book aswell

10 years ago by wingedwolf123

Yeah I do have a type in mind I'd like to work towards it'd be a basic platformer with an rpg element where the player could craft items and affect the environment like in the Hawthorne game written in lua

10 years ago by stahlmanDesign

Quote from wingedwolf123
Yeah I do have a type in mind I'd like to work towards it'd be a basic platformer with an rpg element where the player could craft items and affect the environment like in the Hawthorne game written in lua


For this kind of game (and most others too) I suggest you make a variable in main.js to keep track of game stats. This way if your player dies using the .kill() method, you can still keep track of his inventory because it is not saved in the player entity but the ig.game instance

Example:

//main.js
	playerStats: {
		"deaths": 0,
		"lives": 3,
		"lastMessage": "",
		"isDark": false,
		"music": {
			"toggle": 1,
			"maxVolume": 0.75,
			"currentTrackName":"theme"
		},
		"unlockedLevelDoor":false,
		"entityInfo": {},// for each level visited in current game will contain entities by name and their positions when left that level so can be restored upon re-entry
		"levelSpecific": {},		
		"currentLevel": "Worldmap",
		"lastLevel": "Title",
		"mainLevel": "Worldmap" // can be Smallworld for testing or Worldmap for release
	},

I also have inventory saved there because different characters in my game have inventory.

From any entity you can get or set the info by typeing ig.game.playerStats

And it makes it really easy to save just one object ig.game.playerStats to local storage so the player can reload the browser and start off in the same place or come back later.

10 years ago by wingedwolf123

Thank you very much stahlman I'm sure that will become very helpful over the next week's or months I spend following the examples and,books I have gotten

10 years ago by Apiheld

Maybe you want to learn JavaScript first in context of game programming. This could help you, although it doesn't have anything to do with Impact.js:

http://codecombat.com/

10 years ago by wingedwolf123

thank you for the advice Apiheld i checked it out ive also been using www.CodeAcademy.com 's site and it really has helped me alot when it comes to functions and some of the more basic JS programming syntax.. i plan to keep at it and with the books i ve acquired i thank you guys with all your help so far and helping me keep my head up .. i was using Phaserjs and was starting to get the hang of it a little bit but decided to go ahead and spend the money on impactjs 1 . because it looked like it was a better framework for what i was wanting to do and 2. because i figured spending the money would just help keep me dedicated to my goal

10 years ago by Apiheld

Well, Impact.js is probably more advanced than Phaser and is more feature-complete to get a simple game done within a few hours. Did you follow this video? http://impactjs.com/documentation/video-tutorial-create-a-game

It's quite simple, but at least it gives you a finished game in a very short time. It always helps with the motivation if you see some pixels moving :)

You could also try to use plugins for Impact and once you got them working, you read the code and try to understand how stuff is done.
Page 1 of 1
« first « previous next › last »