dop2000's Recent Forum Activity

  • RBARON85

    You have to do this in 2 steps:

    Step 1. Pick an instance of the sprite.

    You can use any method to pick an instance:

    Sprite->Pick by unique ID - if you know the UID

    System->Pick random - if you want a random instance

    Sprite->Pick nearest/furthest

    etc.

    Step 2. Move to (Sprite.X, Sprite.Y) position.

    Again, there are plenty of ways to do this. The easiest is MoveTo behavior, or you can use Bullet, LiteTween or simply move your object a couple of pixels towards (Sprite.X, Sprite.Y) on every tick.

    Note: Step 2 should be a sub-event to step 1.

  • Maybe just restart the animation after it has ended?

    Character->On Finished "Speak" Animation -> Character play "Speak" animation

  • facecrime

    No, see my code - you can calculate (time-ButtonSprite.timePressed) to fill up the meter while the button is being held in "Is Touching" event. You can add other conditions, say the meter starts filling up if holding time is more than 1 second, and stops after 3 seconds.

    The same formula can be used when touch is released or after finger has moved away from the button - in "Is NOT Touching" event, before resetting timePressed to 0.

    You don't need another flag, since you have timePressed variable. When it's 0, you know that the button is not in touch.

  • You can try something like this:

    Add an instance variable timePressed to the button sprite.

    Create these events:

    Touch: On touched object ButtonSprite -> ButtonSprite set variable timePressed to (time)
    
    Touch: Is touching object ButtonSprite  
    ButtonSprite: compare variable timePressed not equal 0
                                         // use formula (time-ButtonSprite.timePressed) to get the duration of hold
    
    Touch: Is NOT touching object ButtonSprite 
    ButtonSprite: compare variable timePressed not equal 0 
    System: Trigger once
                                         -> ButtonSprite set variable timePressed to 0
                                        // release the charge based on hold duration
    [/code:1rbwue0c]
  • Kyatric, As I understand from the Java code, Card[] array contains 10 cards. (1-based for simplicity)

    Cards which user owns contain value "1".

    Cards which user doesn't own contain value "0".

    The task is to select a random card which used doesn't own. Basically find a random member of the array with value ="0".

    This can totally be done in C2 without the array and much easier. Pick all cards with instance variable="0", and then pick a random card from them.

    Here is a slightly more accurate example:

    https://www.dropbox.com/s/ul8ly6dpzsho7 ... .capx?dl=0

  • You should have posted this in "How do I...?" forum on day two of your quest

    When I have a hard-to-detect problem like this, I start disabling big chunks of the code and adding debug output everywhere. This usually helps to narrow the search scope and find the rogue event really quickly.

  • Do you mean you want to rotate the ship?

    Here is how you get movement angle:

    angle(0,0, Ship.Physics.VelocityX, Ship.Physics.VelocityY)

    You can slowly change ship angle until it reaches this angle, for example:

    Ship -> Set angle to anglelerp(self.Angle, angle(0,0, Self.Physics.VelocityX, Self.Physics.VelocityY), dt/2)

    It's not recommended to change angle for physics objects directly, so you can try to do the same with physics actions like "set angular velocity".

    And, of course you should only adjust the angle when player is not controlling the ship.

  • It's up to you.

    Here are a few tips:

    1. I can drop letters on top of each other.

    Add isOccupied instance variable to your Sprite133 (grey box). Set it to True when letter is dropped to it. Set it to False when letter is dragged from it.

    You can also add instance variables startX and startY to the Letters sprite. On start of the layout, save X and Y position of Letters instances to these variables.

    Then if the letter is dropped on an occupied grey box, return it to (startX, startY) position.

    3. If I pick up letters again after I dropped them, or if I change their order, the Word.text should be recalculated. Currently a letter is just appended at the end, which is wrong.

    You can try something like this:

    Word set text to ""
    Sprite133 -> boolean variable isOccupied set   // this will pick all occupied boxes
       For Each Sprite133 order by Sprite133.UID   // This will loop through occupied boxes
           Sprite133 is overlapping Letters   // This will pick a letter on each box
               Word append text  Letters.AnimationName    // and add this letter to Word
    [/code:1rsijhor]
    
    You can make this a function and call it every time any letter changes its position.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "Letters" sprite is an object.

    When you add copies of "Letters" sprite to the layout, you create its instances.

    For each instance you can select different animation and other properties, set different values for instance variables.

    It's one of the very basic principles in Construct 2.

    All these letters on the layout are different instances of the same Letters sprite.

    To sum up:

    Having 100 letters as 100 different sprite objects is bad.

    Having 100 letters as 1 sprite object with 100 instances is good.

  • Yes, you can do this with arrays if you really need to.

    But the cool thing about C2 is that it's much easier to do without any arrays.

    https://www.dropbox.com/s/3xntvn27607zg ... .capx?dl=0

  • I think what's happening is that Button object in C2 has its own cursor style and it overrides the cursor you set with "Mouse->Set cursor" event.

    You need to use CSS to set cursor style:

    #MyButton:hover {
      cursor: pointer;
    }
    [/code:3n9a7gmn]
    
    You can also change button appearance with CSS.
    See this demo:
    [url=https://www.dropbox.com/s/2hzzgt5n2kebj3i/ButtonStyled_244.capx?dl=0]https://www.dropbox.com/s/2hzzgt5n2kebj ... .capx?dl=0[/url]
    
    Tutorial:
    [url=https://www.scirra.com/tutorials/1283/css-your-buttons-and-textboxes]https://www.scirra.com/tutorials/1283/c ... -textboxes[/url]
  • You don't need an array because you already have CardFaceFrame instance variable on both CardObj and CardTargetObj.

    And there is CardUID that links instance of CardObj with instance of CardTargetObj.

    (I don't remember if I added CardUID or if you had it already?)

    All you need to do is to check if CardObj.CardFaceFrame is equal to CardTargetObj.CardFaceFrame for each pair.*

    If not equal, "win" boolean variable is set to 0.

    If all 6 cards are correct, "win" remains 1, and it means that the level is completed.

    By the way, I'm still on release 246

dop2000's avatar

dop2000

Member since 26 May, 2016

Twitter
dop2000 has 250 followers

Connect with dop2000

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • 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
  • Forum Wizard Made 5,000 posts in the forums
  • Forum Unicorn Made 10,000 posts in the forums
  • x4
    Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • x3
    Quick Draw First 5 people to up-vote a new Construct 3 release
  • x13
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

28/44
How to earn trophies