Thoughts on Animation + Sprite Sheet in C2

Discussion and feedback on Construct 2

Post » Wed Aug 10, 2016 1:05 pm

Hey Everyone!

As a huge C2 fan, I wanted to see how people are optimizing their workflow with C2.

In specific regards to,

- Changing the Speed for every new animation
- Importing 40 sprite sheets
- Setting Custom Default Values for C2 in general (Curious if anyone has played with Source Code of C2 here :D )

Let me know what you are doing to make life easier and share it with the rest of us! :)
B
9
S
3
Posts: 28
Reputation: 887

Post » Wed Aug 10, 2016 1:13 pm

I don't think the licenses let's us play around with the source code of C2, so I usually do those by hand when needed.

I do use a lot of functions and variables/constants however to simplify events.

Sometimes I use maths to understand better how to achieve my goal, like that one time I wanted to set a specific height jump.

Keep in mind importing sprite sheets in C2 means their height and width (of each frame) must be the same, that can be annoying.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Thu Aug 11, 2016 7:38 am

well.. you can't play with c2's editor source, but you can edit export source..

go to install directory of C2 (default c:/program files/construct 2) and open folder exporters/html5.
you will find there - > c2-externs, common prelude, commonace, eveng, expressions, glwrap, layout, system and a few other JS files.
they are the source code of your game that gets put in runtime.js -> it's combined depending on your choices and complexity of your game.
i've been tweaking that, but C2 (ashley) won't give you support if you tamper with it, so you're on your own.

also there are folders in that folder called "plugins" and "behaviours", which have all the JS files (runtime.js / edittime.js) from which runtime.js gets incorporated in that runtime.js file (depending on what plugins / behaviours you use) and edittime - > what is shown / can be edited in editor.
again tampering the default plugins you won't get any support.

i've done some work on those too, things could work better somewhere but ashley just doesn't have time for such massive rework/optimizations and i'm not really a high JS expert nor do i have really the time, and whatever you "change" they won't accept to incorporate in code because it might cause issues.

other than that, most of your events and stuff gets exported to data.js where you won't understand anything because it's just concatenated together.

in the end you don't have to work on those because with good optimization and correct usage your game will work good no matter how big it is.

now to answer your original question:
- i set speed when i choose animation. you can make a function that gets the object from family for example and then sets its speed to designated value, so you won't have to write the same code 100 times, just once.
for example - > function (family, animation,speed) - > set animation on family; set speed on animation; return;

- what do you mean importing 40 ss? in sprite editor? 1 by 1 :)

- same as first. organize your game. here's an example:
turret defense - you got 5 turrets, all different abilities. what are their common properties? fire range, damage, health(maybe), cooldown time, level, etc.. you put those 5 turrent in a family, give that family those properties and voila all your turrets got these properties.
so what happens when you want to level up a turret? all you need is a function which receives a family item. for example - >
function Level (family turret) - > if(turret ==family.smallcanon) - > if (level == 3) return; else level= level +1; ..increase stats...
if (turret == family.bigcanon) - > if (level == 10) return; else level = level +1, increase other stats...
and so on..
if you need a new type of turret - > you just have to change that function, add another if which takes that new turret and changes it's stats, and all you have to do is put the sprite in the family.

ofc this is an easy example, you can do a lot more with functions and families. grouping is the way to go :=) think of your game first then develop
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,450

Post » Fri Aug 19, 2016 2:21 am

Yea haha,

I know about families and the functions, but I need this to be optimized as hell and functions setting default values of animation speed are something I am trying to avoid haha

Damn, Guess I'll wait for C3 then :D
B
9
S
3
Posts: 28
Reputation: 887


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests