Vallar's Forum Posts

  • Hello everyone,

    I am working on a prototype of an idea where items in the game act as cards. Imagine a regular RPG (for the sake of explanation) where each sword, bow, staff, armor, potion, etc... is just a card similar to card games.

    Now the conundrum I am encountering is how to effectively handle loot without too much hassle (if that is even possible).

    Right now, I am thinking of two ways:

    1- Each item is a separate sprite that belongs to a type family. So MeleeWeapons family in C3 would contain swords and daggers for example while RangedWeapons would contain bows and crossbows. I'd manually apply a sprite appropriate for the item and add family variables such as name, damage, range, durability and skill.

    This would require that when, say, I loot a chest, I would have to generate a random number from 0 to how many types of items I have in the game. Each type has a number ID and that random number decides the family I'll create an item from. Then another random number from 0 to max family member size to choose which item in the family to specifically create for the player.

    2- I create a XML/JSON file with all the items. I load up the JSON/XML file at the start. I create a single sprite called "LootItem" for example that spawns when the player loots the chest from the first example. Then at that moment, I randomly pick an ID from the XML/JSON file instead of the above method. The issue here will be that I need a specific PNG for each item and to my knowledge, I can't reference "X.png" in the JSON to load it in a sprite, I'd have to apply it as an animation or frame and know these animation names/frame number by heart to reference in the code. Not to mention the sprite will need to cater to every possible item type's setup. A weapon may have damage and range but a potion won't need those things for example so it might get confusing as the game gets more complex.

    To me, the first solution is more work generally speaking than the second but it is far easier to maintain. If an item changes I just change the specific sprite for it. The ID ranges would require me to remember to change if let's say a family of items became 5 instead of 6.

    The second method seems to save time at first but the issue with loading the art file would make it a complete mess if I decide to use "X.png" for weaponA instead of WeaponB or if any of the IDs changed for any reason. Not to mention the whole mess from dealing with different types of items that do different things, if not for anything, then when I display a tooltip so I don't display "damage: 5" for an HP potion. I am also not a fan of how you extract information from JSON/XML it just feels off in the events sheet.

    What do you folks think? Any feedback/ideas/suggestions are welcome.

    Note I don't want to jump into coding for this setup.

  • > It is slow because I am stepping through the debug window to make it easy to see what is going on.

    And? You should be able to see in the debug window why the Player sprite is moving - either in Bullet or 8direction tabs it will have non-zero speed.

    Apparently having speed or not doesn't affect this. Bullet behavior is disabled and has speed of 900. 8DirectionMovement has no speed but is enabled.

    If I set Bullet speed to 0, it doesn't affect the issue. The issue is nullified ONLY when I disable 8DirectionMovement. Moreover, I am not pressing any buttons whatsoever and the speed on 8DirectionMovement is 0.

    The only clue I have is that the Y of the player is incrementing and thus causing this movement. But I can't see any events in the sheet that increments that value only reads it.

  • Hello everyone,

    I am working on a little prototype with a sprite that has both the Bullet and the 8DirectionMovement behavior.

    For the life of me I can't find the reason why when I enable 8DirectionMovement on the player object it shoots up.

    I tried recreating the same object with the same behaviors and the new one doesn't have the same issue. My events also don't betray any sort of logic that would make this happen.

    Here are my setup and events:

    https://i.imgur.com/e0mWPZH.png[/img]

    https://i.imgur.com/NnEPMTl.png[/img]

    When I hit play I get this:

    https://i.imgur.com/SMwi4Fw.gif[/img]

    It is slow because I am stepping through the debug window to make it easy to see what is going on.

    Any idea what is happening?

  • You do not have permission to view this post

  • I see what do you mean. Thank you very much, I'll recode it using state machines with LOS :)

  • Hi all,

    I am trying to create an enemy type that when it reaches the range it can attack a player from, it dashes into the player.

    I tried to do this with LoS instead of the distance expression I am using below but I get the same exact stutter result.

    First, here is my "code":

    i.imgur.com/S8EODEd.png

    This is the result:

    i.imgur.com/GNm2oNG.gif

    I don't know why the enemy (purple) moves in "steps" towards the player. I tried to chang the speed (currently it is set to 800 as you can see from the text box) while that helped, that "steps" feeling is there but it slightly less noticeable.

    On a side note, the enemy has a Custom Movement behavior enabled on it but I only use it to stop enemy sprites from overlapping.

    Any ideas what is going on here and what I can do to fix this?

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think you may be using by mistake the:

    Sprite "On Collision with another object"

    instead of:

    MoveTo "On Hit Solid"

    Oh, I see. Now I realize what this means. I completely misunderstood the documentation. Thanks for clarifying.

  • It looks like the moveto behavior's stop on solids property doesn't actually let the objects collide or overlap, it stops before they touch at all.

    You can use the stop moveto action on collision to stop instead of the stop on solids property if you want collision based events to fire.

    Just tried this out and you're right, thank you very much. This makes the documentation misleading -- super misleading because it says the opposite:

    Stop on solids

    If enabled, movement will stop if the object collides with something with the Solid behavior, and trigger On hit solid. If disabled solids are ignored.

    Someone needs to fix the documentation and makes sure quirks like that are mentioned in the tooltips.

  • Is your text box large enough to contain the word? If the word doesn't fit, it doesn't get displayed at all instead of being cropped.

    Yes, it is 6x the size of the word.

  • Hi everyone,

    I've got two sprites. Both of them are simply created through the fill color in C3 and their collision shape is set to bounding box.

    I have an event sheet that handles collision and I made sure it is included in the main one.

    The first sprite has a MoveTo behavior with stop on solid true. The second sprite has a solid behavior with a tag. There is NO event to exclude or include the tag as that setup isn't used for anything just yet.

    Collisions on both objects are enabled even on runtime (checked with Debug mode).

    I setup my event as such:

    - Sprite1 OnCollisionWith Sprite2 > DebugText Append "Collision!"

    Now when I run the layout Sprite1 moves towards the target I set to it. It encounters Sprite2 and stops. So far so good, the problem is the text box doesn't change and remains empty. I can see Sprite1 stuck to Sprite2. I can see it stopped moving, yet the collision event doesn't run, any idea why?

    I tried to change this to Overlapping instead of collision and it didn't work still.

    Tagged:

  • Hey everyone,

    I have a top down game and I have obstacles that I would like to vault over. How do you go about doing that?

    There are barricades in the game that the player creates. Now what I want to do is have the player be able to vault over them.

    Here is what I tried to do:

    1- Create the barricade object.

    2- Create a hidden object called "Vaultable Object"

    3- When player steps on Vaultable Object and presses Space, I stop its controls and tween from Vaultable Object on the left of the barricade to the right of the barricade.

    This works perfectly if there is one barricade only. It doesn't work well with two barricades or more as the picked instance is always the first one created. Moreover, this works along the width of the barricade and not the length, I would like the player to be able to do vault in both direction.

    Here are the events I am using:

    i.imgur.com/yVxvPCp.png

    And while at it, quick question, is there a way to have the player jump in a top down game in C3? Maybe that is a better approach so the player can jump any time they want rather it being context based?

    Tagged:

  • object.lineofsight.hitX & object.lineofsight.hitY will give you the coordinates of the intersected raycast.

    You can also use object.lineofsight.hitdistance if you need a quick measure of the distance.

    I didn't know that. Thank you very much!

  • I would do this with LOS/raycasting and MoveTo behavior. Bullet at high speeds is too unreliable and hard to deal with.

    Gotcha. Is there any way I can get the contact point of the raycast? Or perhaps get a point on a direction.

    Say, like in the GIF, I have the ball in the middle but tap on the black box. The raycast will detect collision and it won't move. Now if I can't get the contact point of the raycast, is there a way to say something like "Even if there is a collision with the raycast, move the ball X and Y pixels towards the contact point" for example?

  • Here is an example:

    https://www.dropbox.com/s/80h6upcj4mjf9d9/BulletPushOutSolid.c3p?dl=0

    Thanks. Oh, I see now what you mean.

    I tried that. So the "bullet" in my case is the player and I am trying to create a dash behavior. So when I use the method you have right now, I end up with a weird bug.

    Say I dashed towards a box (from the GIF) and say I hit its left side (coming from the left). Now if I click above the top of the box, for some odd reason the player (bullet behaviour object) teleports to where I click. It happens randomly. Sometimes it happens, other times it doesn't. But usually it is when the object is stuck to the box on one side while I am clicking on the side next to it.

  • At speed this high, even with stepping enabled the bullet will not be able to stop exactly at the edge of the solid object.

    You need to add an event that will "push" the bullet out of the obstacle. In a loop move the bullet backwards 1px and check if it's still overlapping the obstacle. When no longer overlapping - stop the loop.

    There may be better ways to do all this, for example with raycasting.

    The speed is set to 4000 which is the same speed in the Step Example in C3. I tried raycasting, didn't exactly work well (unless I did it wrong). I don't fully understand what you mean here with loop move the bullet. Could you elaborate please?