qxface's Forum Posts

  • I'm trying to get my sprites to walk around to different way-points on the layout. I'm using Bullet movement to do this. I set the sprite's angle toward the way-point I want it to go to, then set its bullet speed. When it gets close to its target, I stop it.

    This works ALMOST all the time. Every once in a while, the sprite will walk in the opposite direction. I don't know what's causing this!

    Here's a CAPX to look at, if that helps.

    This usually happens when moving FROM the Front or Back rows TO the Rear row. Sometimes, I can move 100 times and never see the problem. Other times, it happens the very first time I try to move.

    Is there a better way to be doing this "Move To Location" type of movement? Sort of like the RTS movement in Construct Classic?

    Thanks for any help!

  • Thank you!

    I was able to do what I wanted by shoving a "Trigger Once While True" event after the "On Start Of Layout".

    Can I have multiple "On Start Of Layout" events? Is one way better than the other?

  • I plan on having a few way-points aligned with a grid around my layout. I figured that when I create them at start-up, I would save their UIDs in a 2D array in order to reference them easliy.

    I run a Loop to create the objects and save their UIDs to an array in position (1, loopIndex). Then, I try to "Pick Instance with UID". For the UID, I use array.at(1, loopIndex), the same position I saved the objects to.

    What am I doing wrong?

    Maybe a downloadable .capx will help.

    Thanks for any help!

  • It's fixed in the next build, but there's an infinite loop in your .cap when they're all set to 1 .

    Yes, thank you. This was just a sample cap to demonstrate the problem I was having.

    Great news on the bug fix!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the 'compare value at x' condition of the array does not evaluate correctly if x is 1; that's a bug. i've added it to the tracker.

    you could work around this by using the 'compare' condition of the system object.

    Thank you, that works perfectly!

    I'm glad to see it wasn't just me being stupid.

  • Hi, I am looping through an array, and checking each position in the array to see if it equal to 1. If it isn't, I set it equal to one. If it is, I move on to the next position and check again. If I'm looking at an index that is higher than the length of my array, I start over from index 1.

    The problem is, after I loop back to the first index of the array, I can never increment the index again.

    Here is a cap to demonstrate the problem

    Am I doing something stupid with the loop? Thanks for any assistance!

  • I'm pretty sure this is a bug. You should submit it to the tracker.

    I reported it.

    In the mean time I can work around it by calling a function from the else even with the event that I previously had in the sub-event.

    Thanks for looking at it.

  • I'm having trouble with the else statement. If I add a sub-event after an else, the entire else never even triggers.

    Else Statement cap

    In this example, click the "try else" button and you'll get a message box saying "Positive!". Click the "swap" button" to change the text field to -1 and click the "try else" button and nothing will happen.

    But toggle event number 5 in the event sheet editor and run the cap. Now if you Click the "swap" button" to change the text field to -1 and click the "try else", you get a message box saying "Negative!"

    It seems like adding a sub-event to an else event prevents the entire else event from triggering. Even the actions before the sub-event.

    Am I doing something wrong here?

    Thanks for any help!

  • They all have 'destroy on startup' attribute ticked.

    Ah yes, yes...... so sorry for that..... That one little box makes a big difference apparently. Thanks for taking the time to check out the file and for the response.

    Now things work pretty well when I start the cap with three character objects created at startup. However, when I spawn the characters as we've learned about in the platform tutorial, things don't go so well. At runtime, I create three character objects and assign them cSpeeds of 1,2 and 3 and I can see that each character has the correct cSpeed, but the "Pick Object With Highest Variable" action picks the character with cSpeed = 1.

    Static and Spawning Characters

  • I need some help with the "Pick Object With Highest Variable" action. I made a simple cap with three instances of a sprite object. The objects each have a private variable called cSpeed, set to 1, 2 and 3 respectively. Then, during the startup, I call "Pick Object With Highest Variable" and tell it too look at the objects' speeds. Then I set a text object to the cSpeed of the object that was selected.

    It seems like it should be simple enough, but nothing happens. The text field never changes. If I put a message box action after the "Pick Object With Highest Variable" condition, it never fires. I feel like I'm missing something here.

    Pick Object With Highest Variable Cap

    Thanks for the help

  • to pick your current node, you could use the 'Pick by evaluate' condition and use the expression "node('nodeID') == character('nodeID')". i don't know if there is a better way than using a single condition for this

    you might need to invoke the condition through a function set to forget your picked objects if you plan on doing this in the scope of the 'node clicked' event (to gain access to the non-clicked nodes).

    Thank you so much for your help, dkdoom. That really pointed me in the right direction. It turns out that each object automatically gets a unique ID that you can reference it by. Excuse me, I meant "by which you can reference it."

    Here is the new improved cap. When the character moves to a node, the node array gets a 1 in the location that the character moved to and the old node's array gets a zero in the position where the character used to be.

    Download The Cap Here

    Next up, I will try to put in multiple characters and have them take turns moving.

    Thanks again!

  • The game I'm working on now has a little square walking to a random image point on a node when you click on the area.

    The character object holds a private variable with the assigned ID number of the node that it walked to last. The nodes have an array of twelve numbers that represent the image points of the node. When the character walks to a node, I set the corresponding item in the array to a 1.

    My question is how can I set the item in the array of the node that the character is leaving to a zero before it leaves for the target node? Do I need to loop through all the nodes and check to see if the node id is equal to the node ID stored in the character? It seems like there should be a better way...

    Download The Cap Here

    P.S. further down the line, I'd like to have multiple characters that take turns moving when you click. If you have any helpful hints for that, please let me gnow.

    Thanks everybody for any suggestions

  • Thanks for these great tutorials. I'm really learning a lot about Construct from them.

    I understand why you use separate objects for the platform behavior and the animation. It works really well for Charlie who is pretty much shaped like the same rectangle whether he's standing, running, jumping or swimming.

    What if you're using character animations that should make the hit-box a different shape? Like a taller, thinner character that needs to lean forward while jumping. Or maybe the character's arms swing outside the hit-box while walking.

    It seems like the whole point of the hit box is to have an object that doesn't change shape so you don't have to worry about rubber banding off of walls or hanging off a ledge by your nose.

    Thanks everybody for any suggestion.

  • Thank you that works beautifully!

  • Thanks for the reply. i'm thinking now that I'll probably use some detectors to see if the player is on solid ground or a platform and adjust the code thusly (pretty much what you said)

    So (hint hint) keep those platformer tutorials coming, please!