Knovolt's Recent Forum Activity

  • Not 100% sure of your intention but one thing that does stand out the unnecessary "every tick" with the sub events - try removing that...

    also the first ("line" 2) where you are making sprite and sprite 2 invisible ?

    Sorry for the delay.

    Not sure whether you still think I am stuck, or wondering how I came to my solution?

    Either ways, the "Experiment 3 Copy.capx" is the solution to my problem, albeit in a weird way, so don't worry, it has been solved.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In editor click on "+1" sprite and set the instance variable (eg value) to 1

    In editor click on "+2" sprite and set the instance variable (value) to 2

    In event sheet:

    On left click on "sprite" : -> system add sprite.value

    Already sorted it, but thanks though. Good for future reference.

  • Different instances can have a different values for an instance variable (the variable name is ofcourse the same)..

    I do not get how to set this up in the events. Both sprites still add the same amount when clicked.

    EDIT: Never mind, just got it

    Thanks

    R0J0hound

    LittleStain

  • I haven't looked at your capx but if the two buttons are instances of the same type, then you could give them an instance variable, call it value and set one to 1 and the other 2. Finally when you click on it add button.value.

    How do I set one to "1" and the other to "2", when they are the same sprite/has the same instance variables?

    BTW here's the print screen of the 2 sprite buttons. They are copy/pasted (as shown by only 1 sprite object in the project bar).

  • I kind of had this problem before. Give my thread a read, and see the solutions further down (disregard thread title, just read further down/next page as well!).

    scirra.com/forum/viewtopic.php?f=147&t=162982&p=987237#p987237

  • So in the capx example, I have 2 sprite buttons. BUT, they are copy/pasted.

    How would I add 1 to the variable "points" by clicking the left (+1) button and add 2 by clicking on the right (+2) button. As far as the events go, both buttons register as +1 clicks.

    Thanks in advance.

    capx:

    drive.google.com/file/d/0BzM_Ir0LBMx_Q01rQ1ZrRGNzT0E/view?usp=sharing

  • ultrafop

    Thanks for the input and ideas. But, with your help and a little changing around, I got this working.

    gyazo.com/8c7b830a981693ee8cafc55bd43412a2

  • How would you add different values to the same global variable?

    Eg:

    I click "button", and it adds 1 to "gVariable".

    I click "button" a second time, it adds 2 to "gVariable".

    I click "button" a third time, it adds 3 to "gVariable".

    I click "button" a fourth time, it adds 1 to "gVariable".

    Then it continues to loop by adding 1, then 2, then 3, then 1, then 2, etc...

    Is this possible to do in as few events as possible? Rather than have many, many different events/functions and calling them?

    Thanks in advance.

  • try adding a condition level number variable = 2

    and for level 3 level number variable = 3

    If you read your code out loud if your exp reaches to the number 200 then go to level 2. But you have no condition that says I am in level 3 when the exp reach to 200.

    A friendly tip a machine is dumber then a rock. We have to input exact logic for construct to behave the way we want to.

    Wow that was simple XD Thanks so much!

    Future reference for anyone:

    gyazo.com/41c6009fbfa576dd24aae8b306d0790c

  • The easier thing to do would be make a simple function that sets a level variable base on experience level and let the experience variable go as high as it wants...

    Ie. countEXP goes up as experience goes up and has no cap. The function compares countEXP and sets level variable based on countEXP value using a case type set up: countEXP <100 level=1; countEXP >100 but <200 level=2: countEXP >200 but <300 level=3: etc.

    Then your main events can call this function anytime they need current level.

    I've got 2 questions.

    First, how do you compare global variables with functions? I can only add/subtract/set variables. Unless you meant I add the compare as a condition, but then I would need to make tons of those functions for each level.

    Second, wouldn't the compare "countEXP <100 level=1; countEXP >100 but <200 level=2: countEXP >200 but <300 level=3: etc" give me the same problem?

    I mean each time the character levels up, the countEXP is set back to 0. So when they are level 3, and countEXP gets set back to 0, and they keep earning exp, they'll go eventually reach to the point where countEXP >100 but <200 is true, thus set back the level from 3 back to 2.

  • If you want to move one object and have the child objects follow, you can always use the Pin behavior.

    Don't worry, I got the problem solved, but in a messy way ha. Check out the post above/the 2 capx files if you're interested.

    I needed a second button to appear exactly like in the capx, instead of moving the first button to where 2nd button position was.

  • Any chance you can post a link to your capx ?

    Sure here are two, "Experiment 3" is the one with working stuff. "Experiment 3 copy" is an example of which the problem is existing.

    (Note: Test "experiment 3 copy" by clicking the red button, and then clicking the spot where the 1st red button is underneath the blue square. You can still click that when you don't want it to!)

    BTW this capx is so ghetto and 100% not the most efficient way to achieve this

    Experiment 3

    dropbox.com/s/0gf49gusnsylymb/experiment3.capx?dl=0

    Experiment 3 Copy

    dropbox.com/s/wxkbaqcvi1ntgzp/experiment3%20-%20Copy.capx?dl=0

Knovolt's avatar

Knovolt

Member since 7 Oct, 2015

None one is following Knovolt yet!

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies