Terraria

  • Ok then. I guess I'll see if I can find some tutorials. Also, are you saying it doesn't matter what size of tilemap I have?

  • I'm not 100% sure but I think it shouldn't matter too much. Using it within the editor may be a different story since there is no chunking (I guess?)

    I'm really no expert though.

  • Ok. Thanks anyway. I guess I'll just have to run some tests

  • Construct already automatically chunks tilemaps, collisions, and - if you enable 'Render cells' - rendering, to ensure maximum performance even across colossal layouts.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you. I'll try that out.

  • dropbox.com/s/xyaqhepde2j7uol/Block%20Water%20Example%20%282%29.c3p

    Back to the water example. I've looked at it again and just can't figure out how get it to work. It's not essential to my project, but I would still like to have it. I will need some help getting this example to be like Terraria's water. Thanks.

  • Anybody have any ideas how they did the chests? There are fifty slots per chest. Each slot has many variables, e.g. strength, speed, knockback, etc. Instance variables would not work very well because there would have to be many hundreds of them. How would be the best way to store the data, especially if there are many chests? Ideas are appreciated.

    Thanks,

    Give me a Pixel

  • Arrays!

    Also I don't think chests store the objects directly, but rather a reference to it.

    E.g. in this chest slot arrayAt(5,10) is the object ID 17. Object ID 17 is the reference to a second array where you get all the data of the item from with arrayAt(17, X). At least that's what I would do.

  • I thought arrays might be the answer. The only problem is I have almost no experience with them.

    So your saying use one array to store the data of a chest (One array per chest), and one main array to store the chest's IDs? What if I have a lot of chests? I still am a little fuzzy on this. Could you possibly make an example?

    Much thanks,

    Give me a Pixel

    EDIT:

    Yes, I now understand what you mean. I will have an array full of each item with all of it's stats. Then I would only need an instance variable or array for each slot and it's quantity (I have 40 slots so the chest would need 80 instance variables). When you open the chest, If a slot's corresponding variable is not empty, it would retrieve all the data for that item from the array and load it into that chest slot.

    This is a good idea (I can't think of a better one yet), but that will be very tedious to fill in the array. There are almost 200 items! Another thing is that this would work for the player's inventory as well.

  • I tried to make a spear like Terraria but I need some help. I made it and it works perfectly, except it won't stay with the player. Here is the code:

    + Inv_Box: Item_Type = "Spear"

    ----+ (no conditions)

    -----> Player_Parts: Set Swinging to True

    -----> Player_Arm: Set animation to Dictionary.Get("Armor") & "_Swing" (play from beginning)

    -----> Player_Arm: Set animation speed to 0

    ----+ (no conditions)

    -----> System: Create object Player_Weapon on layer "Objects" at (Player_Arm.ImagePointX("Weapon"), Player_Arm.ImagePointY("Weapon"))

    -----> Player_Weapon: Set Type to "Spear"

    -----> Player_Weapon: Set angle toward (Mouse.X, Mouse.Y)

    -----> Player_Weapon: Move behind Player_Arm

    -----> Player_Weapon: Set animation to Inv_Box.AnimationName (play from beginning)

    -----> Player_Weapon: Set animation frame to Inv_Box.AnimationFrame

    -----> Player_Weapon: Set Damage to Dictionary.Get("Damage") + int(random(-3, 3))

    -----> Player_Weapon: Set KnockBack to Inv_Box.KnockBack

    -----> Player_Weapon: Set Speed to Inv_Box.Speed

    -----> Player_Weapon: Start Timer "Thrust" for ((25 - Self.Speed) ÷ 10) ÷ 3.5 (Once)

    --------+ (no conditions)

    ---------> System: Wait for previous actions to complete

    ------------+ Player_Weapon: Is between 270 and 295 degrees

    -------------> Player_Weapon: Set angle to Self.Angle + 45 degrees

    -------------> Player_Arm: Set animation frame to 0

    -------------> Player_Parts: Set Not mirrored

    ------------+ System: Else

    ------------+ Player_Weapon: Is between 295 and 345 degrees

    -------------> Player_Weapon: Set angle to Self.Angle + 45 degrees

    -------------> Player_Arm: Set animation frame to 1

    -------------> Player_Parts: Set Not mirrored

    ------------+ System: Else

    ------------+ Player_Weapon: Is between 345 and 65 degrees

    -------------> Player_Weapon: Set angle to Self.Angle + 45 degrees

    -------------> Player_Arm: Set animation frame to 2

    -------------> Player_Parts: Set Not mirrored

    ------------+ System: Else

    ------------+ Player_Weapon: Is between 65 and 90 degrees

    -------------> Player_Weapon: Set angle to Self.Angle + 45 degrees

    -------------> Player_Arm: Set animation frame to 3

    -------------> Player_Parts: Set Not mirrored

    ------------+ System: Else

    ------------+ Player_Weapon: Is between 250 and 270 degrees

    -------------> Player_Weapon: Set angle to Self.Angle - 45 degrees

    -------------> Player_Arm: Set animation frame to 0

    -------------> Player_Parts: Set Mirrored

    -------------> Player_Weapon: Set Flipped

    ------------+ System: Else

    ------------+ Player_Weapon: Is between 200 and 250 degrees

    -------------> Player_Weapon: Set angle to Self.Angle - 45 degrees

    -------------> Player_Arm: Set animation frame to 1

    -------------> Player_Parts: Set Mirrored

    -------------> Player_Weapon: Set Flipped

    ------------+ System: Else

    ------------+ Player_Weapon: Is between 115 and 200 degrees

    -------------> Player_Weapon: Set angle to Self.Angle - 45 degrees

    -------------> Player_Arm: Set animation frame to 2

    -------------> Player_Parts: Set Mirrored

    -------------> Player_Weapon: Set Flipped

    ------------+ System: Else

    ------------+ Player_Weapon: Is between 90 and 115 degrees

    -------------> Player_Weapon: Set angle to Self.Angle - 45 degrees

    -------------> Player_Arm: Set animation frame to 3

    -------------> Player_Parts: Set Mirrored

    -------------> Player_Weapon: Set Flipped

    The last part is just to make the arm line up with the angle of the spear (https://www.construct.net/en/forum/construct-3/how-do-i-8/shooting-problems-146513?kws=)

    I need it to stay at the player's image point "Weapon." The problem is that I can't use 'every tick -> set position to. . ., or the pin behavior because the spear actually moves. I don't want to do animations. Any suggestions on how to make the spear stay with the player? It needs to set position to his image point, but also the offset of the movement and angle of the spear.

    Thanks,

    Give me a Pixel

  • After giving it some though, I am going to switch the inventory to your way, WackyToaster. I checked out arrays and it will be much simpler to just store the quantity and the array reference in the inventory slot. This will also be useful for chests, as I will probably do them the same way. Do you have any suggestions on how I will be able to get out of giving the chests instance variables? From how I interpret your last post, you are saying to have a separate array for each chest? That would work, except you will be able to place chests, and you could have hundreds of chests. Any other ideas? Thanks.

  • You could store it like this.

    Chest instance variable > Array.asJSON > reference to object

    So you would only ever need a single Array object for chests. When you open a chest you load chest.variable into the array object. There you can manipulate it however you want (take items out/put items in) and once the chest is closed you save the array back into the chest instance variable with array.asjson.

  • Hmmm. I'm sorry, but that doesn't make much sense. Could you please make a small demo project for me? Thanks.

  • Here you go

    wackytoaster.at/parachute/terrariaChest.c3p

    Note that this is just a very basic (and just quickly thrown together) example. So I recommend to improve upon it if you really wanna use it.

  • I'll check it out. Thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)