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

0 favourites
From the Asset Store
An educational game for Fill in the Blanks. An easy to use template for developers to build larger games
  • 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

  • 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)?

  • 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

  • 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.

    [quote:2tyhlm1g] 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.

    [quote:2tyhlm1g]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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • 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!

  • 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.

  • 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.

  • 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.

  • 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

  • Alright!

    Installing the last release and re-creating the app worked and I am very happy with the result.

    I hope to implement the snap feature next ....

    Too bad that I can't post a link yet because I'd love to get a little bit of feedback to see what you think?

    It's been a loooong day .... but I accomplished what I wanted to.

  • vancouver sorry, I didn't notice your newest post.

    Why don't you type the link with some digits altered...? e.g http://yyy.whatever.com

    That way we can check upon your progress and input our feedback... <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    EDIT- I see that the link is automatically generated from the http://... part (?)

    Test: yyy.whatever.com

    ok that seems to work <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Hello again eli0s,

    thanks for the linking tip.

    My main site is: http://littlecomposers.com/ (if that gets removed, just copy paste " littlecomposers.com "

    From the main menu, click on > PLAY and from the drop-down menu select "Play" once more.

    This would be the full link: http://littlecomposers.com/apps/pre-piano/index.html

    Tonight, I am adding the snap to box feature and maybe change the background back to white so that it matches the Flash app a little better.

    I love C2 and wish I had discovered it earlier! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • The links are working just fine

    Yes, please do change the black BG ! I really liked what I saw in the video presentation. At first I was skeptical for the color coding of the keys, but seeing how you implement the I & V chord groups and their relation with the corresponding notes, I really believe that this method is instructive without complicating things.

    I really enjoyed your site overall, and that trumpet design kicks a**

    I wish you best of luck and if you get stuck anywhere don't hesitate to post (just use the eli0s to let me know) and if it is with in my abilities I'll try to help

    CU around

  • Thank you eli0s!

    You've already helped me a lot and I am glad that you saw the concept ... how it works, etc...

    Yes, I am changing the BG right now plus a few other things like I've already mentioned.

    The plan is to have a handful of HTML5 alternatives for those visitors who can't access the Flash content.

    I am glad that you like the trumpet. Kids just LOVE it. It's the first instrument they pick. It is available for the iPhone and iPad and still gets some downloads (after over 3 years in iTunes which is why I am so excited about C2.

    We'll talk soon and stop by once in a while. There will be a lot of new content posted throughout this summer.

    Again, thank you for your encouraging comments. They made my day!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)