dop2000's Forum Posts

  • Top number on your left image should read "-90" or "270".

    I don't really understand what your problem is. If you are trying to increase the angle by 90 degrees (or rotate it 90 degrees clockwise), you can simply add 90.

    Set Sprite angle to (Sprite.angle+90)

    This might give you a result which will be greater than 360, but the system will convert it to correct angle.

    Or you can use anglerotate expression:

    endAngle=anglerotate(startAngle, startAngle+90, 90)

  • There are a few expressions related to angles:

    angle(x1, y1, x2, y2) Calculate angle between two points

    anglelerp(a, b, x) Linearly interpolate the angle a to b by x. Unlike the standard lerp, this takes in to account the cyclical nature of angles.

    anglediff(a1, a2) Return the smallest difference between two angles

    anglerotate(start, end, step) Rotate angle start towards end by the angle step, all in degrees. If start is less than step degrees away from end, it returns end.

    You're probably looking for anglediff, although you should know that it always returns positive result. I.e. anglediff(10,50) returns 40, and anglediff(50,10) also returns 40 (not -40).

    Also these system events may be useful: "Is between angles", "Is within angle", "Is clockwise from"

  • Oh, so you are using some external "HTML" plugin, like this one?

    I don't know anything about this, sorry. Maybe you can disable resizing with CSS, or if you know javascript you can try to change this in plugin source code. Or try another plugin, I think I've seen a few similar ones (for C2 at least).

  • Could you explain in more detail what are you trying to achieve?

  • If a variable is only used in events from one group, you should consider moving this variable to this group. This helps to de-clutter your project. Local group variables are only accessible by events in this group.

    You should be aware, that local group variables are reset between calls. So it's not a good idea to put a variable like GameScore in a group, because it will reset to default value all the time.

    If you want your Local variable to keep its value, you need to change its type to Static. The problem with Static variables though is that if you need to reset them, you'll have to do it for each variable ("System Set GameScore to 0"). Unfortunately, there is no "Reset all static variables" action in C2.

    Same rules apply to local variable defined inside of events.

    As far as I know, "Include" does not have effect on Global variables. Global variable defined in one Event sheet is visible to the entire project, no matter if this event sheet is included into other event sheets or not.

  • Don't use Button or other form controls. They are not "native" to Construct, there are lots of issues with them.

    They may be ok for some types of games like quizzes, but I wouldn't use them in a platformer.

  • So you want your character to be always in the center of the screen? Simply add ScrollTo to your character then.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not sure if this a good method, but it seems to be working:

    Create an object (sprite for example), set Global=Yes, add NoSave behavior to it.

    Add instance variables that will store the items you bought. When player buys something in the shop, put it in these instance variables.

    In "On Load Complete" event read these variables and add the items to player's inventory.

    Or I guess you can do this with Local Storage. When exit from the shop, write all inventory into the local storage.

    In "On Load Complete" load inventory from the local storage.

  • robotpencil I think you can do the same with 8-Direction. Disable standard controls, set acceleration=10000, deceleration=0, On key pressed simulate controls.

  • There was something wrong with your project, some bug maybe. I created a new project with the same Physics movement and scrolling and couldn't reproduce the jittering.

    So yeah, use 8-Direction and everything will be fine.

  • No problem, glad I was able to help!

    And it didn't take any time at all

  • I think you can still use "find". And if you want to pick TextObject with your event, do this:

    System -> Pick by comparison -> TextObject where find(TextObject.text, "Shooter")>=0

    This will pick all TextObjects which contain this word.

  • I think what you are looking for is the find() expression:

    Set variable S to "The quick brown fox jumps over the lazy dog"
    
    System-> Compare two values -> find(S, "fox")>=0   
    [/code:5lcduap9]
    
    find() expression returns position of the string ("fox") inside another string (S). 
    It returns -1 if string was not found. So if the result >=0, this means that the string was found.
  • Yeah, for some reason when you use Physics, jitter happens.

    Although it looks like the sprite moves with constant speed, on some frames its x,y coordinates are not updating:

    X.............dt

    2410 0.016657

    2421 0.016676

    2421 0.016625

    2431 0.01665

    2442 0.016645

    2452 0.016638

    2463 0.016682

    2474 0.016693

    2484 0.016655

    2495 0.0166

    2495 0.016657

    2505 0.016651

    2516 0.016657

    I don't know why this happens, but I'm guessing that's what causing the jitter when scrolling.

    Why are using Physics anyway? With 8-Direction behavior scrolling works perfectly.

  • Wait, I don't understand. Why do you need the second sprite? Is it for scrolling only?

    So the Mech moves smoothly and jitter only happens when you add scrolling?

    Why don't you try this:

    System->Scroll to X -> lerp(scrollX, Mech.X, dt*4)

    System->Scroll to Y -> lerp(scrollY, Mech.Y, dt*4)

    Also, the link you posted if broken.