dop2000's Forum Posts

  • You could move them toward each other if the distance is greater than 300.

    That was my first idea too. But it won't work very well if there are obstacles. It's better to move objects by changing velocity values, then the 8direction behavior will handle things like collisions and sliding properly.

  • Turret behavior is rotating the knight.

    Also, with multiple goblins you need to pick a goblin instance first. For example, the nearest goblin instance, or the instance with the lowest HP. Once the correct goblin instance is picked, use "acquire target" action in the Turret behavior to start firing at it..

    Alternatively, allow the Turret to automatically pick its target. And then move the knight to that target. Use Knight.Turret.TargetUID to identify the target goblin by its UID.

  • You will need to disable automatic targeting and use "Acquire target" action instead. For example:

    for each idle turret -> pick enemy turrets in range -> pick nearest of them -> acquire it as a target.

  • You can ask chatgpt all Javascript-related questions, it's pretty good.

  • getAllAnimations() is an array. Here are the names of the first 2 animations:

    runtime.objects.Cannon.getAllAnimations()[0].name

    runtime.objects.Cannon.getAllAnimations()[1].name

  • It's actually officially supported in the API now:

    runtime.objects.Sprite.getAllAnimations()

    construct.net/en/make-games/manuals/construct-3/scripting/scripting-reference/plugin-interfaces/sprite

  • I would then need to add logic that would somehow move the spell already in the active box back to the inventory.

    But you don't need to move it back, because the spell should not have been removed from the inventory in the first place!

    When you assign some scroll/potion to the active slot, the inventory should not change. The item stays where it is. Only the global variable changes, and an image of the scroll appears in the active slot - you can even use a different sprite to make it less confusing.

    .

    That youtube tutorial you found isn't very good.. Usually an inventory system is based on an array or JSON object. All collected items and their quantities are stored in the array. When "I" is pressed, the inventory screen is dynamically generated from the array data.

  • You can pay every year.

    But no, it will not be possible to permanently purchase it, because it's a subscription model.

  • Have you tried simply copying this line (Ctrl+C) and pasting it onto the event sheet (Ctrl+V)?

    {"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"every-tick","objectClass":"System"},{"id":"evaluate-expression","objectClass":"System","parameters":{"value":"LayoutAngle<180"}}],"actions":[{"id":"set-layout-angle","objectClass":"System","parameters":{"angle":"min(layoutAngle+90*dt, 180)"}}]}]}
    

    It should add the event. Then you will be able to study it.

    Also I suggest starting with some tutorials, looks like you need to learn the basics of programming in C3.

  • "Every tick" is a System event, you add it on the event sheet.

    Try just copying+pasting this code to your event sheet:

    {"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"every-tick","objectClass":"System"},{"id":"evaluate-expression","objectClass":"System","parameters":{"value":"LayoutAngle<180"}}],"actions":[{"id":"set-layout-angle","objectClass":"System","parameters":{"angle":"min(layoutAngle+90*dt, 180)"}}]}]}
    
    

    I don't need to rotate sprite.

    It will rotate the layout, not a sprite. I suggest trying the second method with Tween behavior.

  • I'm trying for days.

    You should've asked earlier!

    Two methods:

    1.

    On every tick
    LayoutAngle<180
     -> Set layout angle to min(layoutAngle+90*dt, 180)
    

    2. Add Tween behavior to any sprite.

    On start of layout
     -> Sprite: Tween "ang" value from 0 to 180 in 2 seconds
    
    Sprite: Is Tween "ang" playing
     -> System: Set layout angle to Sprite.Tween.Value("ang")
    

    With tween you can select cool easing effects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If there's a tilemap, you can use Tilemap.snapX(player.x) and Tilemap.snapY(player.y) expressions.

    Or use these formulas:

    x = int(player.x/16)*16+8

    y = int(player.y/16)*16+8

  • Wow, you didn't make it easy.

    and replacing the current active scroll, moving that scroll back into the inventory.

    Where exactly is this code that should move the previous scroll back into the inventory? Perhaps it should work like this:

    1. Check if there's an item in the Active Slot. If true - re-add it to the inventory, then destroy the item in the Active Spell slot.

    2. Move the clicked item to the Active Spell slot.

    .

    But to be honest, I don't like that the item is essentially removed from the inventory when it goes to the active slot. What happens if you pick up another copy of the same scroll - should it go to the active spell slot, increasing its quantity, or to the main inventory? How do you swap items in the active slot when the inventory is full?

    It will be a lot easier if the item assigned to the active slot stayed in the inventory. Just use a global variable, say ActiveSpell="invisibility". On right-click find the invisibility spell in the inventory, reduce its quantity by 1. If none left, remove invisibility spell from the inventory, reset the ActiveSpell variable to "". This is how it's done in most rpg games.