DUTOIT's Recent Forum Activity

  • Create an instance variable and add that as condition.

    or

    Use the sprites UID

    Nice to also use function.parms to pass on the information once you get the sprite.

  • touch.x<layoutwidth/2 is a loop so

    Put your custommovement accelerate 300 in, and put self.x-2 and self.x+2 respectively.

    It loops as long as that condition isn't met.

    See

  • You have to use

    Touch Is in Touch

    Simple example moving only on X

    So Touch| is in touch

    system| touch.x < Layoutwidth/2 Sprite|Set X to Self.x-2

    And do same for opposite side but inversed

    So Touch| is in touch

    system| touch.x > Layoutwidth/2 Sprite|Set X to Self.x+2

  • Sorry none of your links work.

    But, this is how you do it. In the tutorial section there are a number examples on random, none duplicates using array.

    So the array randomizes pulls a number and deletes the number (so impossible to get duplicate)

    You now have a number. Use that number to get your question from txt however you do that.

    Edit: okay you put links in

    What you want is to have array for numbers (number questions you trying to randomize) have that array in a function that spits out the number, which is deleted as I said previously.

    Use that number to fetch your questions.

    Or shuffle it into array at start of game, then delete on at a time

  • No problem. Sorry I didn't give it too you straight off the bat

    Good you did a little practice.

    Reason it didn't work is cause you add 1 to totalvalue when you needed to add total of each current value and not 1

    I see I typed that too, so my bad, but I was doing it out of head - lol.

    Anyways, functions are great. Now learn how to pass info via param and that single function could possibly find total stars, stars for specific level, etc etc etc

    Functions are most powerful part of C2.

  • Here you go

    Did this quick.

    Used function, with local variables

    Stores Total stars in global variable totalstars... so just display it where you want. or look at it in debugger to see it in action.

  • filechooser?

    [quote:39gjhf3s]Using files

    Once a file has been selected, it can be accessed using a URL. While many URLs reference web resources on the Internet, the File Chooser plugin returns a special URL that refers to the local file. This URL typically starts with "blob:" (since the browser's term for an arbitrary set of data is a "blob") followed by some kind of unique ID. By accessing this URL the local file is accessed, without using any Internet connection, so this also works offline.

    The file URL can be used like any other URL. For example, it can be requested by the AJAX object to load its contents as text, or passed to the Sprite object's Load image from URL action to display it.

  • All cards are practically the same, except the copy on them and a few images specific to the card.

    You need a card.

    You need the info to populate the card and load in some custom image (character portrait).

    And you want user to customize it....

    Text file or json (both are easier than xml)

    Text use tokenat or regex

    json load into array or dictionary

    I know c2 can load images in, they just need a url which can be stored with all the data in text or json.

    Not sure if you can include from folder, but you can have user pass a url via his text/json file.

    Edit: I am talking from not actually having done this to such a degree

  • Use 1 sprite with each frame being a fish. Put instance variables in sprite of fish.

    Now compare sprite against sprite... works same as family, except restrictive to 1 type of something.

    Now compare fish with fish

  • Can use pick ...

    Can use foreach text....

    Can use text with condition campare two put in text.uid = xyz

    etc

    many ways to peel a banana.

  • Foreach creates a loop that goes round and round for each x element it cycles through each line in the array.

    Condition allows us to restrict amount of lines/loops to a specific rule

    Our rule is x must be greater than 2

    Why 2?

    Because tutorial says if player attempts level he gets a 1, if he wins the level he gets a 2, if he wins and gets 1 star, he gets 3, wins and 2 stars, he gets 4 and if he wins and gets max stars he gets 5

    Its just a number.

    We know that 2 of the 5 is not stars so we want to subtract the 2 to get the remainder.

    Examples

    x = 3 player has 1 star 3-2=1

    x = 4 player has 2 stars 4-2=1

    x = 5 player has 3 stars 5-2=3

    So we loop through each x element that is greater than 2

    We add total x number to a total variable

    we also add 1 to count number of times it cycles (this is number of x entries that have stars.

    No we do the same. Total -2 = stars but I did it a litle different

    Total - (numberlevelswithstars*2)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Amount of stars...

    Okay found tutorial.

    So he stores data as follows

    finish level = 1

    win = +1

    star1 = +1

    star2 = +1

    star3 = +1

    So if a player finishes level and wins and gets 3 stars x = 5

    So you want to for each x element

    you want to add a condition curent value > 2 [Don't want to count levels without stars]

    System add 1 to TotalStars (variable)

    Sytem add 1 to NumberStarLevels(variable)

    outside loop

    System Subtract Totalstars numberstarlevels*2 [because we want to remove the 2 in each]

    The above isn't pretty. But I am trying to show you the logic.

    Foreach x.

    Condition that x > 2 (2 being player has won, but no stars)

    We want to add all those up.

    Now we want to subtract the finish 1 plus the winning 1 to get total stars

    You can see this all clearly using the debugger

DUTOIT's avatar

DUTOIT

Member since 17 Jul, 2013

None one is following DUTOIT yet!

Trophy Case

  • 11-Year Club
  • x5
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Email Verified

Progress

14/44
How to earn trophies