How do I change the fill color of an instanced sprite?

Get help using Construct 2

Post » Mon May 19, 2014 9:22 pm

I am trying to make a piano keyboard but use instances of one sprite which represents one of 12 keys.
I'd like to have a different color for every key.

Should I just make 12 sprites?
Basically, the app is really simple.
All there is is a piano keyboard with keys that have a one frame animation.
Plus, there would be notes which can be dragged on screen to make a composition.

Any hints, or links to tutorials would be most appreciated. - thanks guys :)
B
14
S
4
Posts: 190
Reputation: 1,735

Post » Mon May 19, 2014 9:28 pm

@vancouver I don't understand, isn't this already covered in your other Topic (https://www.scirra.com/forum/viewtopic.php?f=147&t=105720)?
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Mon May 19, 2014 9:47 pm

Hi eli0s,
I played with the file and tried to dissect it so that would understand how it works.
Yes, it is a piano that functions but I don't understand why there is only one key used for everything.

I wasn't able to adapt it to implement what I envision (which is to replace an existing Flash file with a HTML5 version).

The reason why I want to re-use is that I get very bad performance on my Android powered Galaxy Note3 as there is considerable lag between touch and sound playback.
Now I am trying to optimize the piano to see if I still could make it work somehow.

Once I have that, I'd love to buy C2 and publish the instruments on my website.

I am still new to C2 and it will take a few days until I make sense of it all.
Maybe sometime in the future I will be able to understand your file and redo the project.

Sorry for the confusion. - v
B
14
S
4
Posts: 190
Reputation: 1,735

Post » Mon May 19, 2014 10:12 pm

vancouver wrote:I am trying to make a piano keyboard but use instances of one sprite which represents one of 12 keys.
I'd like to have a different color for every key.


English is not my forte ( ;) ) but what I understand from this paragraph is that you want instances of a single Sprite to form the piano. That is exactly what I have made in my example.

Should I just make 12 sprites?


I know nothing about exporting on android, I don't care about phones and tablets, but I find that using 12 different Sprites for each note is highly unlikely to affect performance. If you find that using the variable system on a single Sprite too complicated, you can use 12 sprites with no problem at all.

Basically, the app is really simple.
All there is is a piano keyboard with keys that have a one frame animation.
Plus, there would be notes which can be dragged on screen to make a composition.


This part sound way more complicate than the piano part. You really should read some of the basic tutorials. If you can warp your mind around action script, C2 event programming system will feel like a cakewalk. :)
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Mon May 19, 2014 11:48 pm

Hi eli0s,
I finally got it (looking the way I want to).

The instrument plays well too and I am happy.

I probably did it the hard way but as you say, 12 sprites with not much movement and no physics action should be very light on any device.

Now I need to figure out how to create a new text object every time I drag it from its original position, then I have something to show!

Again, thank you for your help and patience. -v
B
14
S
4
Posts: 190
Reputation: 1,735

Post » Tue May 20, 2014 12:18 am

I don't really understand the mechanic that you are trying to implement. Will you have a pallet of some short that the user will pick notes and sequence a melody..?
Perhaps the drag & drop behavior will help you with the first part. You can use the "System | create object" action to create the text object at any time.
The difficult part will be to assign those text notes into a correct sequence and link them into the sound system. But maybe I am completely wrong here, as I said, I don't quite understand the mechanics of your app.
If you provide more info, perhaps me and/or some other forum members can assist you with that!

Anyway, keep it up!
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Tue May 20, 2014 12:46 am

I'm almost there....

Unfortunately, C2 crashes during export which is probably because I've installed the latest beta the other day to open a file someone made.

Anyway, I have the app "ready enough" to be useful.

Soon I will be able to post links and then it will be much easier to give advise.

I just restarted the PC. Maybe I will be able to make an export ... will see.
B
14
S
4
Posts: 190
Reputation: 1,735

Post » Tue May 20, 2014 12:50 am

Yeah, I can't export.
The msg says:
Check failure! Minifier did not output a file ....

Anyway, I probably will have to uninstall this beta, install the latest release and try again.

If I works, I will buy a license and the rest will be history! :)

UPDATE!

If I uncheck "minify", I can export ....
So far, I've exported about five builds successfully but I think t hat was before I installed the latest beta.
Last edited by vancouver on Tue May 20, 2014 12:58 am, edited 1 time in total.
B
14
S
4
Posts: 190
Reputation: 1,735

Post » Tue May 20, 2014 12:53 am

Try with the latest stable as you say, and if the problem persist, contact Ashley-make a post on the bugs forum. He is always trying to help.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
26
G
5
Posts: 1,146
Reputation: 9,829

Post » Tue May 20, 2014 1:00 am

eli0s, I just exported without minifying which works.

Anyway. I am happy with the progress. I am confident that I can replace my Flash apps soon which is why I am trying out C2 in the first place.

I'll bug you later :)
B
14
S
4
Posts: 190
Reputation: 1,735

Next

Return to How do I....?

Who is online

Users browsing this forum: amazingdream, lordsas, mekonbekon and 66 guests