CREATOR4's Forum Posts

  • ,

    Thank you for your suggestion, it gave me an idea. I set the X in the tile movement to 300 and Y to 0. Then removed all the other behaviors except tile movement - and it worked!

    The problem is, it still won't work with the mouse, only works with the keyboard.

    I can't seem to use 'cell_width' from your formula, I'm told it's invalid. (There is the possibility I'm entering it incorrectly) (I replaced cell_width with 85, the cell width)

    I'll keep plugging away.

    Thanks for the help.

    when you use mouse you should temporarily disable the tile movement behavior so it doesn't get in the way

    Yeah I meant for 'cell_width' to be a variable that you define :)

  • you could do something like

    set player x to round(mouse.X / cell_width) * cell_width

    this would make the player move to the mouse, but snap it to the grid at the same time

  • Thanks, but your file doesn't do what the original does.

    Whoops, I didn't even look at what it was supposed to be doing. Here it is:

    gofile.io/d/5abZNS

  • You're looking for families: construct.net/en/make-games/manuals/construct-3/project-primitives/objects/families

    Here's your file edited to work with families: gofile.io/d/woJLon

  • Thanks everyone for your suggestions!

    blackhornet was almost there with collisions. I added a "Turn off collisions" action right after the "on collision with tree" event, and everything worked as normal. I guess it just kept colliding and restarting the timer each tick!

    I then turned them back on once the character had finished collecting wood, so that they can drop it off at the storehouse.

    I told you about collisions a few posts ago!

    "However, I can anticipate there being a possible problem if the character's collision box changes during it's animation. It may repeatedly collide with the res_tree as it's frame changes. Try opening the game in debug mode so you can get a better look at what the timer is doing"

    blackhornet is right about the solution as well, it's a good idea to have a sprite that acts as a hitbox and then a skin that you pin to the hitbox. It will make your life a lot easier. Disabling collisions is not a good long term solution. Imagine your character gets attacked while collecting wood. The attack won't collide with your character because collisions are disabled!

  • As You Can See By The Title, Construct 3 I Just Made A New Game Work Hard On It, Suddenly When I Save WHEN I SAVE!! It Says Login With Google So I Login AFTER I LOGIN I LOST ALL MY WORK GOD DAMNIT!!

    There Is Another Pain In The Ass Feature, YOU NEED TO PAY TO GET UNLIMITED EVENTS,For Me It's Okay That Exporting Multiplayer Etc Is Premium Feature, But For Gods Sake Why Only We Have 50 Events, Our Country Is Poor And Especially Its Quarantine, CAN YOU EXPECT ME CREATE A "HIGH QUALITY GAME" IN A MONTH!!!

    If you are having trouble affording C3, there is a pretty good free engine called Godot:

    godotengine.org

  • Could you just store all the Sprites' object histories in a dictionary?

    The key would be the sprite's UID and the value would be the sprite's JSON data

  • I was about to do that, but I decided to re-check the Debug Preview one last time. It turns out the "gatherResource" timer is being reset every tick, which I didn't notice before (I only just discovered the Watch tool!):

    It tries to go up, but only ever gets to 0.1/0.2 seconds before being reset. There aren't any other interactions with that timer in the Events Sheet, except for the "On Timer" condition below it.

    The parent event to that set-timer-event is just checking if the Human has a variable of job->woodcutter, in case you were wondering. No reason for any clashes.

    Thanks for your help so far!

    So If Human's job = woodcutter -- > Set timer?

    If that's really the only parent condition then the timer is going to be constantly restarting, which is going to override itself and never let it complete. Try adding a 'Timer "gatheresource" is NOT running' condition before you set the timer. That'll prevent the timer from being set if it's already running

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Put 'On Timer' as it's own top-level event, not as a sub-event

    Ok, I did that but still no joy. This is what I have now:

    There are no other events impacting these two, they could effectively run on their own.

    I'm wondering if because it's not a sub-event of the collision condition, it now doesn't know which tree to deduct from? If so, how would I re-link it?

    To link the tree and the character you can use UIDs.

    Give the character a variable called TreeUID

    Then, when the character collides with the tree set TreeUID to res_Tree.UID

    When the character's timer goes off use Pick Tree By UID: character.TreeUID to pick the correct tree

    However, I can anticipate there being a different problem if the character's collision box changes during it's animation. It may repeatedly collide with the res_tree as it's frame changes. Try opening the game in debug mode so you can get a better look at what the timer is doing

  • ok,

    looks like the idea of a parallel instance variable seems to work --

    So name a sprite type has a name instance variable and the family of that sprite type has an f_name instance variable-- which is inherited to the sprite type as well.

    I now ensure that both are the same by creating an on start of layout event where i for the sprite f_name to name.

    Like this name is now available in both family type and sprite type ...

    thanks,

    However, I think in the future a simpler solution should be available, for example, to simply add an alias for sprite type in picks and then refer to the alias in expressions -- an alias would have all properties available and be treated as if its a different type for picking.

    Dan

    From what you describe it sounds like you don't need any variables in the Sprite. Couldn't you just have all the variables in a family and only ever perform code on that family?

  • And yes, if the functionality given by the sprite's variables is something that should reside in a family, you can just move the variables over to the family

  • Thanks,

    Yes, I tried families,

    Trouble is that once i refer to picks by family, i can't access the instance variables of the underlying sprites via the sprite family name.

    However, I need to access instance variables so i can do conditions across both sprite families.

    is there a solution for that?

    thanks,

    Dan

    You can access the underlying sprites by doing Pick Sprite by UID Follower.UID

  • there's a couple of ways. The way I like to do it is make 2 families

    One family is called "Follower"

    The second family is called "Followee"

    Put your sprite in both families

    Now you can do something like

    For Each Follower

    Pick Followee by UID "Follower.FollowUID"

  • You can't put triggers as subevents of other triggers

    Right now you're trying to put 'On Timer' under 'On Collision'

    Put 'On Timer' as it's own top-level event, not as a sub-event

    (Even if C3 did let you put 'On Timer' under 'On Collision', your character would probably never gather wood. Your code would make it so your character has to simultaneously collide with the tree RIGHT as his collecting timer goes off)

  • ok i got it (i did it without the division tho)

    nice :)

    yeah the division is only if the origin is in the center