Give me a Pixel's Forum Posts

  • 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

  • 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.

  • 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

  • I will give that a try. Thank you!

  • Hello again,

    I was wondering if it would be possible to create real-time upgrades. For example you can click the upgrade button, the game waits however long (i.e. 1 day), and then the item gets upgraded. The twist is that you will have to be able to shut your device down/ close the tab, and then when you re-open it, it will take however much time has passed. Also, would it be possible to add some coins to a mine every so often, and then when you click/ touch the mine you get that amount? Again, it must be in real time. Would the best way be to read the device's date and time, and then when you log on it compares the date and time from when you started and the current time and date to see how much time has passed. Thanks.

  • Glad you figured it out.

  • Happy to help.

  • No problem. By the way, the best way to upload a picture is to take a screenshot, paste it into paint, crop it, save it, and then hit the 'insert image' button. Then choose that file.

  • 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.

  • You could also give the title object the 'persist' behavior. editor.construct.net

  • Where do you store your data? If you store it all in the dictionary, you could create a save and load like Demoniore. If you want to save the whole level, there is an example on the home page. editor.construct.net

  • Thank you. I'll try that out.

  • Do you mean like Terraria's? terraria.gamepedia.com/Hooks

    If so you can go to my Terraria thread and post there. There are many people following that thread that might be able to help you. construct.net/en/forum/construct-3/general-discussion-7/terraria-148798

    You could also try searching the forums. There might be a good example out there.

    Give me a Pixel

  • Yes it's possible. I wanted a website for my games too. After some searching, I found NeoCites. Your first site is free and it is written in HTML. Here is my site that I made and it was completely free. Please pardon the unprofessional appearance. It's more in the testing stage now. My game (High Speed Chase) is under Skill Games.

    give-me-a-pixel.neocities.org

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok. Thanks anyway. I guess I'll just have to run some tests