AllanR's Recent Forum Activity

  • WRS

    I was only showing how to store the number of stars in an array, and save that in local storage.

    in your screenshot you store the level name as an instance variable, and that is perfectly fine - I just didn't want to make a lot of levels...

  • WRS

    you can save the entire array AsJSON...

    I made a quick sample...

    https://www.rieperts.com/games/forum/levelstars.capx

  • to pick the object in the second function you would have to pass the UIDs of the TimeText and Clock as parameters:

    function1
    	create TimeText
    	create Clock
    	call function2 TimeText.UID, Clock.UID
    
    
    function2
    	Pick TimeText by UID - function.parameter(0)
    		Pick Clock by UID - function.parameter(1) - then do what you need to do...
    

    as for adjusting the timetext x and y coordinates, you are only looking at the x value for TimeText - which is where it starts. You need to factor in how wide it is to make it fit on the screen...

    I made a sample to show you how I would do it. I did it all in one function because I didn't see any reason to do it in two... but I added a call to a second function just to show how to pass the UIDs.

    https://www.rieperts.com/games/forum/timetext.capx

  • kiugetski

    that is probably the edge of your layout for that layer - because of the parallax settings. put an object on the edge of that layer to see if it shows up, or use layertocanvas from the player's layer then canvastolayer for the background to see what the coordinates are there.

    you may have to create stars farther out than you think because of the parallax... or it could be something else. it would help if you made a sample capx with just the layers, stars and player to look at.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • heyguy

    C2 will tell you when an animation is finished...

    in your function you start cutscene animation "Scene01"

    so, outside the function make an event:

    cutscene - On animation "Scene01" finished - (then add all the actions after the wait...)

  • s707927

    well, you got me curious... so I looked into it. there is an open source project called StepMania that has hundreds (thousands?) of songs with the song data in various skill levels.

    so, I loaded a song and the dance data, figured out how to parse it, calculated the speed the arrows have to move, and tried to get the tolerance right for hitting the targets.

    this is only about half done - it doesn't keep score, count the hit statistics, combos, etc... and it doesn't calculate the note values properly - it assumes they are all quarter notes. You are supposed to read up to the next comma in the array data and then figure out the note values but that was too much for one night. Because of that, this sample will ONLY work properly with Beginner or Easy skill level.

    the songs also have data for two player mode, and lots of other game features...

    this will get you started, but there is a LOT more involved! it was fun figuring out this much - Good Luck!

    https://www.rieperts.com/games/forum/dancedance.capx

    oh, I have it using the arrow keys on the keyboard, but you will probably want to change that. Also, if you press a wrong arrow key it will kill the next note for that target - even if it should be ignored for being too far away... and lots of other issues too...

  • Gadgetkk

    that could be a browser issue... trying to cascade the windows or something.

    if you maximize the preview window, it should always look the same.

  • Rory

    that was my first comment too... I like to keep my code all collapsed down to the minimum - so it acts like an index. Then I expand just the sections I am actively working on.

  • the "Wait 0 seconds" does not take the picking with it. Functions always reset all picking, and functions are considered part of the event that calls them - whether they are below or above. The eventsheet is executed top to bottom, but functions do not count - their code essentially gets inserted where it is called from.

    so, when you call a function, you can pass in the UIDs of objects to manually pick as a parameter, otherwise whatever the function does will apply to all instances. Do you only have one instance of the clock and timetext?

    For keeping the timetext fully on screen, you will need to know the total width and height required and then adjust the touch coordinates as necessary...

  • kiugetski

    when you create the stars, you can use "Move to bottom" to send them to the bottom of the layer.

    or have a separate layer above all the background stuff for the player and other foreground objects.

  • the problem is that you create the clock and timetext in the first function, and then call a second function. C2 has not finished creating the objects, so you can't access them in the second function unless you pick them by their UID, or wait until they have been fully created.

    they are fully created after the next top level event from where they were created. calling a second function is just extending the original event, but breaks all the picking.

    to make your code work, add a "Wait 0 seconds" action before you call SetTimeText. That tells C2 to not execute actions after the wait until the end of the current tick. By then the objects will be created and your SetTimeText function will work the way you expect.

    You can avoid all the viewport trouble by just saving the touch coordinates from the HUD layer instead of the layout coordinates (which is what happens if you don't specify a layer - as in your code):

    LastTouchX = Touch.X("HUD")

    LastTouchY = Touch.Y("HUD")

    then when you create the objects on the HUD layer they will be at the touch point (and on screen) every time.

  • Toddler

    you can do all that in C2 without a custom plugin...

    I added a MoveThreshold which can help filter out small movements that you might want to ignore.

    https://www.rieperts.com/games/forum/mousemove.capx

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies