Sync music issues - Should I consider leaving stencyl?


  • *
  • Posts: 4645
I only browsed through it, but it looks like it could help.
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.


  • Posts: 214
Sooo I am bran spankin new to programming, I am guessing I need to use custom blocks as an interface between stencyl and my AS3 code. I am guessing I need to make variables with in the code mean something inside Stancyl. I am going to look at the help pages and maybe other peoples work if anyone has any suggestions or rescources and could point me in the right direction I would greatly appreciate it!!! Judging by what I just wrote might be a good indication of how new I am to programming lol


  • Posts: 713
I am actually making a rhythm game as well in Stencyl.  I think that although basically any type of game is possible, Stencyl just favors games that are 2D platformers.  I am not very far along (just a mode where you play random notes right now).  I haven't tried to sync the notes with background music yet.  As for playing notes, there is a slight delay due to the fact that Audacity (I think) added silence to the beginning of the note.  I tried to have a pause function but that did not work with spawning notes by "every n seconds".

As for matching animations with the note presses, with an advanced tweening code I made, I managed to create a sword that swings in different ways (but button mashing prevents the actions from completing) and ALWAYS returns to its starting point.

Here is one section of the code I used for the swinging sword:
Code: [Select]
Tweener.autoOverwrite = false
Tweener.addTween(actor, {x:actor.x+100, time: 10, transition:"easeInOutQuad", useFrames:true, delay:0});
Tweener.addTween(actor, {y:actor.y+100, time: 10, transition:"easeInOutQuad", useFrames:true, delay:0});
Tweener.addTween(actor, {angle:actor.angle+90, time: 10, delay:0, transition:"easeInOutQuad", useFrames:true});
Tweener.addTween(actor, {x:160, delay:10, time: 10, transition:"easeInOutQuad", useFrames:true});
Tweener.addTween(actor, {y:actor.y, delay:10, time: 10, transition:"easeInOutQuad", useFrames:true});
Tweener.addTween(actor, {angle:0, delay:10, time: 10, transition:"easeInOutQuad", useFrames:true});


  • Posts: 214
Yes I agree Stencyl is fantastic for 2d platformers, but I would love to use it for my rhythm game just because its so easy to accomplish a lot quickly. So you obviously are more into programming then myself can you give me advice on where to start to use the code from here
into stencyl?

is it possible?


  • Posts: 713
Here is what I have so far as a game:

Since I am using a "every n seconds code" (which does not pause) it cannot be paused without glitching.  I need a timer that pauses...but I'll live with this for now.

In my game(I have not put in background music yet), tempo is controlled by the speed (well, when I implement it...) of the notes as they go across the screen.  I see the issue for the background music, since it will play as the game lags.  Instinctively, I was avoiding background music, and really hoping that I could get away with only using small sections of music triggered by key presses.

To control tempo, I multiply the speed by a number (this can also be done with Tweens).  Not a BPM, but can be found with math.

I'm not exactly an expert programmer(except maybe with tweening) but I can work well if I find a good list of commands.

If I were to attempt to create a reliable method for keeping the background music in check I would need to look up a list of code commands for whatever Stencyl uses (it uses Tweener instead of generic AS3 for tweening).  So, if there was a way to see how far along the song was vs. the game, you could force the music to jump to the section that the game was in if it got so many seconds away.

Personally, I hate using other people's code since I can't edit it as well as my own.  Also, pure AS3 does not work with Stencyl most of the time.  It's better to work with a mix of blocks and custom and never only custom.


  • Posts: 214
I got you it looks interesting, I kid of see the direction you are going and think it could be pretty rad! I definitely there are a lot of buttons to push maybe you could make them like up, down, left, right cursor keys and w,a,s,d. I would love to see a product with some bgm music to just see how it worked.

me personally I am horrible with coding I dont know anything but desperately want to learn and make a successful engine for my rhythm game.

do you know good places for a beginner to start?


  • Posts: 713
With custom code this seems promising:

But that is not really for beginners (and I haven't figured it out yet).

So far, if you can separate your song as bunches of notes, it may be best to trigger each note by a script individually.  That way, the movement and the song will be all together (if you can manage to delay the sounds to the right moment).  This may screw with tempo if you plan to implement it, but you could just stop the sounds earlier with a faster tempo.  Since this is all doable with blocks(if you have the notes all ready to go), it is easy to do.

Interesting idea about arrow keys/WASD...The only reason I went with the line of "zxcvbnm," as my keys is that they are all lined up, just like a real piano keyboard and the note layout in the game.  I can't see myself eliminating the current layout, but that layout (of exactly the number of keys I needed) seems like a definite second control setup.