Vallar's Recent Forum Activity

  • Hey all,

    So I am trying to create this ordering system. Let's say I have 4 textboxes; sender, description, ID and recipient. The first and last one are a random string of characters. Description is a long body of text. Order is just a number (int to be exact).

    However, each user in the game will have a bunch of orders and I need to store that in an array.

    What I want to know is:

    1- How do I turn the values in the 4 textboxes into a JSON (tried to look for it but seems all info is about parsing from not converting to JSON)?

    2- Then how do I add that to an "Orders JSON array" (not sure how that is done) to write it to a server?

    Any ideas how I can achieve this?

    Tagged:

  • I meant a string of text, which is a list (comma-separated) of enemy types.

    Oh, I see. I get what you mean. Yeah, that works Really well if "find()" would just simply find what I want. That is actually great. I didn't know I can do that.

    Thanks.

  • I would probably use a pair of text instance variables, for example:

    Type="F2" (this enemy type)

    EnemyList="F1,F4,F5" (what enemies are hostile to this one)

    On collision with another enemy check if that's other enemy type is in the list using find(ThisEnemy.EnemyList, OtherEnemy.type) expression.

    Note, that this expression only works if you have less than 10 enemy types. Also, you might want to create a family and define these variables on the family.

    Huh, I can use lists as instanced variables on objects? How can I do that?

  • Hello everyone,

    In my game I have multiple factions. And they basically have some friendships and hostileships.

    So basically enemies are like this:

    F1 > F4

    F2 > F3

    F4 > F1 and F3

    F3 > Everyone.

    Now in my setup, I have an object (the actual enemy sprite) and a hidden "range" sprite as child that I create at runtime so can't pre-setup it. When an object enters range, I'd like to detect which faction it is + which faction I belong to and see if it matches an enemy.

    The only way I can think of this happening is to have an "id" for each faction and then have variables like "enemy1, enemy2, enemy3, enemy4" and a "selfID" in the range object. Upon collision I compare if selfID is "F1" then ignore everyone but F4 from enemy1, enemy2, enemy3 and enemy4.

    But I feel this method is very crude and will end up breaking soon. Any ideas how I can tackle this so I can detect which kind of object entered and how I deal with it?

    Tagged:

  • Bump, still looking for a solution.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey guys,

    is there some simple way how to make my "player" sprite change weapon type after hitting certain threshold ? For example when i hit "Score" = 10,000, it changes my weapon to stronger version. Then when i drop under 10,000, it switches to previous version.

    Thanks.

    One way to go about this is to have a group in an event sheet say "Strong Gun" group and "Weak Gun" group. Then have a global variable (if score isn't level based and is something more global to the game and is carried from one level to another) called score.

    Now let's say your score increases if an enemy dies, so your code would look like this:

    Event: On Enemy Destroyed -> Add 1 to Score.

    SubEvent: Score >= 10,000 -> Group "Strong Gun" activated

    -> Group "Weak Gun" deactivated.

    Same thing would happen for the event when you lose score. In Strong Gun you have your strong gun logic and in Weak Gun you have your weak gun logic.

  • Hey all,

    I have a minimap that you can bring up in the game if you press "M". It isn't an interactive map (i.e. it just displays the layout of the current level you're in and that is that, no unit movement or that sort). However, when you are fresh into the level the minimap has fog of war (i.e. completely dark and you can't see the level itself) and as you move around the dark areas get revealed.

    For the minimap I am using one of the methods I found searching these forums. This is my code:

    https://i.imgur.com/GxrQB4I.png

    Right now I have it where I manually place black sprites around the level with size and location I want them to appear on the minimap. Unfortunately no matter how big and "encompassing" I make the sprites there are still seams and areas that don't get covered fully on the minimap despite these areas are completely covered in the level with the black sprites.

    This is the result I get:

    https://i.imgur.com/MccLXMR.png

    As you can see in the minimap (the small picture in the middle of the screen that has lots of black on it) still has seams and some areas that are displayed (walls at the bottom for example) that aren't covered. Yet in the layout I have the black sprites (that spawn their counterpart on the minimap) covering that entire place.

    Any ideas what is wrong? Any ideas what can I do to cover the minimap completely with these black sprites to simulate fog of war? Or maybe anyone has a better idea how to implement this mechanic?

    Thanks

  • You need to set both Scale Rate and Parallax to 0% for GUI layer.

    They are both set to 0, still can't see the GUI sprite at all.

    EDIT: I found a way that fixed it; instead of zooming the layout, I just changed the viewport size to something very small and that did the trick. I can now see my GUI just fine.

  • I think I am missing something, I have this event:

    On Start of Layout -> Set Layout Scale to 7.

    This is because I am using a 16x16 sprites and otherwise the "camera" is very zoomed out.

    The issue here is that my GUI layer (layer with parallax set to 0, 0) doesn't show AT ALL. It is visible, sprites are set visible, everything is fine. If I remove the scale, I can see everything in the GUI layer. If I add the scale, this happens. Am I "zooming the camera" wrong? Or is there a way to display the GUI properly when scaling the layout?

    Thanks.

  • It seems this question has already been asked!

    Really? Could you link the question and answer because my searches yielded nothing like what I want to do.

    Note I am not looking to compare between two tiles and find them equal or not. I am also not looking for how to compare between two arrays.

    My question is how to save data from tiles in a non-error prone way that I can compare with data pulled from a different source (not tiles but actually simple sprites) and do this in an easy and non-error prone way.

  • Hey everyone,

    A bit of a strange question, but let's say I have a level. This level consists of 2-3 tilemap objects. These tilemaps are layered on top of each other to create the visuals of the level. Standard stuff.

    However, the player is given a mechanic similar to Mario Maker; where you have some buttons these buttons are basically walls, floors, doors, etc... and the player has to reconstruct a simplified map similar to the original using these tools.

    A few notes:

    * The player does not need to make the map detailed. So for example let's say we have a room and in it there are 4 walls, one with a window. There is a floor with a table on it, a chest and 4 chairs. Then there is a door. The player doesn't need to replicate windows, tables or chairs. But they need to replicate the chest.

    * The player isn't using the same tileset to recreate the level, they are using a different one.

    * The player can modify any "tile" in their UI that is set to one thing if it is mistaken.

    Now based on the above, how do you reckon I should go about this? One way I thought about this is to create an Array file and then manually type in the tiles in each index and then for the player create an Array object and add the tiles based on index. However I quickly realized this is VERY error prone. Because I could easily miscalculate the tile or in a huge map (60+ tiles) it is easy to forget or get lots as to where you were looking. Specially when the editor doesn't have any kind of "numbering" on it or any such thing.

    So how would you recommend I do this in the easiest way possible while not making the process too error prone?

    Thanks.

    Tagged:

  • Hope that answers your questions

    Very much so, thank you very much. I'll try to adjust to this new mode of thinking. Also just in case, my questions regarding performance were just to get to understand C3 more. I still don't know its performance boundaries and best practices -- the questions were to learn that is all. Thanks a lot again for being thorough with your explanation and fixing my project :D

Vallar's avatar

Vallar

Member since 24 Mar, 2014

None one is following Vallar yet!

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

14/44
How to earn trophies