pandabear7413's Forum Posts

  • Since posting this I realized I can use Event Groups for this, and enable/disable groups based on the situation. E.g., I can have a Player Attack group with all the keyboard events I use for attacks, and disable this when interacting with a menu. This is a lot cleaner than the individual conditionals I've been using for every keyboard event. I'm looking forward to seeing how this will work.

    Any other 'best practices' folks have been using?

  • In my game, the 'z' keyboard key serves many functions. Depending on the situation, it can be used to kick, shoot, reload, talk to an NPC, continue a conversation, end a conversation, or select items in a menu.

    I've been using a combinations of conditions to determine what code should be executed when 'z' is pressed. They check for player 'state' (instance variable) values, object visibility, overlap with other objects, layer visibility, or a combination of these. It works but is getting messy, and when I add new features or make changes to the game, my logic is prone to break. It's basically spaghetti logic. I'm pretty early in my game so I have to think there's a better way to implement this, and that this is a common challenge with some proven solutions.

    Is there a 'best practice' on how to implement and manage overloaded key events? Maybe use of a data structure or dictionary opens up some cleaner options?

  • "Add Sprite.pickedcount to killCount" -- That's good stuff right there!

    My understanding of picked logic was: iterate through every step in the action block X times, where X = picked count

    But it sounds like you're saying: iterate through every step THAT REFERECES THE PICKED OBJECT(s) in the action block X times, where X = picked count. For all other steps, execute those once

    Is my new understanding correct?

    Thanks

  • Here's my code. I have a 11 sprite objects with health = 1. Pressing space subtracts 1 from their health, so all will have health set to 0.

    The code properly destroys all 11 sprites, but it only increments killCount once (the highlighted action). Why does it not increment killCount once for each sprite that meets the health <=0 condition?

    The commented "for each" section does what I want, but I'm trying to understand why I need this. I obviously don't understand object picking as much as I thought.

    Thanks

  • Agreed. I have thousands of values (my array is 500+ rows and 140+ columns) and I do a select all (ctrl+a) and copy (ctrl+c) in excel, then paste that into the top left cell in the C3 array editor. Works great.

  • My game is similar to KiwiStory, where I'm creating multiple platform levels in a single layout (pic below). In my game, the enemies move towards the player based on Line of Sight behavior (LOS). They start with a smaller LOS range, but once they "see" the player or are hit their range is increased to the Layout width, so they always have LOS to the player on that level.

    The player can move to different levels in the layout, similar to how the doors work in KiwiStory. The problem is, once the player moves to another level, the enemies on the original level may still have LOS to the player, so they try to move towards the player. I want to keep them from 'seeing' the player unless they're on the same level.

    I see a few ways of implementing this. E.g., a global currentLevel variable that's set when entering the doors, and only enemies with that value can see the player. Or I can compare an enemy's Y coordinate to the Player's Y to determine if they're on the same level. Or I can wrap each level in "obstacle" sprites which can block LOS. Each has its pros and cons, so I wanted to see if there are any strong recommendations for one, or if there's an even better one I'm not thinking of?

    Thanks

  • I want to place several enemies on my layout using the Layout view in the C3 editor, some of which are facing right (normal) or left (mirrored). Is there a way to do set the Mirrored property using the Layout editor? I see a setting for 'angle', but setting it to 180 rotates the sprite upside down.

    If not, my thought is to set an instance variable called mirroredAtStartup, and programmatically mirror the sprite on layout start based on that value. Or is there a better solution?

  • I'd like to be able to change an external file (.csv) at runtime and load it into my game. I'm able to use FileChooser to do this, works great.

    However, I want to be able to change the same file and reload it multiple times during a game, and would rather not have to use the FileChooser "file picker" dialog every time since the filename/location doesn't change, just the file contents. Is there a way to use the FileChooser "file picker" dialog just for the first file selection/load, and then "reload" the file after it's been modified without having to use the FileChooser "file picker" dialog each time? Hope this makes sense.

    FYI this is just for game dev/debugging purposes, and I don't plan to ship the game with this file loading feature.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Will give it a shot, thanks!

  • Finally getting back to this. I'm performing the following steps:

    - add the plugin via the Addon manager

    - create a new project

    - add a CSVToArray object to the project

    - preview the project (or layout)

    Here's the issue: The project window pops up but just shows "Please wait, loading..."

    I'm guessing the plugin is no longer compatible with the latest C3 release? Would be great if someone can confirm if they're seeing the same thing on their end. I'm running R276.2 fyi.

    Thanks

  • Can someone please provide a simple c3p showing how to use Rex's csv to array plugin

    (https://www.construct.net/en/make-games/addons/234/csv-array-c3-runtime)? I'd like a programmatic way to load a .csv into an array, vs what I currently do (copy and paste excel data into the C3 array editor.

    Thanks!

  • Can someone please provide a simple c3p showing how to use Rex's csv to array plugin? I'd like a programmatic way to load a .csv into an array, vs what I currently do (copy and paste excel data into the C3 array editor.

    Thanks!

  • I guess I could do either, but right now it's just in a file on my hard drive.

    Some background: Currently I copy the contents of the .xls from Excel into the C3 array editor and then restart the game, but I change the .xls contents so often that this process adds a lot of time to my workflow. My goal is to be able to update the file using Excel, save it, and reload it into my running game using a hotkey without having to restart the game. FYI I'm using this only during the game development. When I deliver the game, the array contents will be hardcoded into the project.

  • I want to import a .csv file at runtime to populate an array. I found this great example by oosyrag, which unfortunately I can't reply to because it's too old. This is almost exactly what I need, but I'm looking to load the csv file without having to use the fileChooser plugin -- I.e., I want to just hardcode the filename into the code so I don't have to manually choose it every time. It's probably an easy thing to do but I can't seem to figure it out. Can anyone provide some guidance on how to do this?

    https://www.construct.net/en/forum/construct-3/how-do-i-8/csv-similiar-array-json-vice-129070

  • My function has 2 parameters, and number and a boolean. When calling the function, I can set the value for the number parameter using a number variable, but I can't use a boolean variable to set the boolean parameter value. The only option I have is to manually check the box.

    This means I need to check the value of by boolean variable beforehand, which seems cumbersome. Am I missing something?