Knovolt's Forum Posts

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

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have posted screenshots + GIF below. But basically, I have countEXP global variable, and it is set to 0 when the player levels up.

    I have got when exp=>100, it'll level up to 2. I have done it all the way to level 3, and when at level 3, the countEXP starts from 0 and increases past 100, at which point it goes back to level 2.

    Is there a way around this?

    The events for the making of the exp bar:

    gyazo.com/8b843efecc858b8164f19db7177a2acf

    The events for the leveling up:

    gyazo.com/b18c6700b73b8dee6d353c20fa726e1c

    And the GIF of the problem:

    gyazo.com/08f06b3b372c528797b691d4fb991035

    (As you can see, level 2 to level 3 works fine. But of course because the countEXP gets set to 0 at start of new level(level3), it counts in 15 from 0, until it becomes =>100, which turns level 3 back to level 2.

    Thanks in advance.

  • When clicking/touching collision is detected for all objects under your touch/mouse..

    If you want only the top instance to react:

    on lightbulb touched/clicked

    lightbulb pick top (instance)

    > add your actions

    Thanks for the help, worked great in your project, but couldn't get it to work on mine.

    So I did when "button" is clicked, with condition "instance variable A" is = 0, you can click the button. Then I had an action to set "instance variable A" to 1, then system spawn new object "button(copy)". And I believe the new copied button still has default "instance variable A" as 0, so I can still click it.

    Learnt alot from your project, and will keep the pick top/bottom instance for future reference!

  • I have been told that containers are in the free version.

    example of grouping objects together using instance variables

    example of grouping using container

    Sorry to bother again, but how do I stop this from happening? Posted a GIF below.

    Basically, I can still click the light bulb underneath the overlapping light bulb (shown by how I can still turn the bulb on+off).

    Thanks.

    gyazo.com/1f6a7f2a4ecd32b878b5bfb564c70ea2