vee41's Recent Forum Activity

  • Easier option is to use bullet behaviors angle of motion. You can access it this way in expression: object.bullet.angleofmotion

  • What's bad practice about it?

    You'll end up with massive amount of variables that you see all the time, instead of variables only being available in scope they are needed in. In general, using lots of global variables encourages coding style that gets messy quickly. That is how I was taught to program, avoiding global variables in situations when more efficient options are available. :)

    EDIT: Here is what I was talking about.. Some of those points are relevant for C2 as well.

  • scrollX and scrollY might be what you are looking for.

  • Well the highlighting function is meant just to highlight the squares. You'll need some way to determine which way AI wants to go, and for that, you'll probably want some sort of pathfinding algorithm. :)

    Here's general idea how I've done AI pathfinding in similar boardgame:

    Determine where AI wants to go, then:

    a) Use pathfinding behavior to find path to the target square

    b) Draw a 'move here' token to each square that is along that path

    c) Draw as many squares as the AI token has moves

    d) Move the token to next 'move here' token until there are no more

    Pathfinding behavior does most of the work, I just iterate through all the steps it takes and generate markers where necessary.

  • Wait, I think I understand what you mean now. In the log it shows the function only being called once when the other recursive functions are called multiple times.

    So it should be called more than once, and it's not. Is that what you mean?

    Yes that was what I was aiming for, glad that you spotted it :)

  • Yup, the UID of initial boardspace matches the one at boardspaces xi yi. Thus, no more calls.

  • The functions that trigger a console warning are the player highlighting function, computer highlighting function, and building a direction list.

    One thing about all three functions - they are recursive and call themselves until 'stop conditions' are met. However, they appear to be working perfectly, even if Chrome gives me a warning.

    As to the actual issue of the local static text 'dirs' always equaling "", I think I'm going to just make it global and see if the scope change solves the issue.

    Like I demonstrated in the screenshots, the scope is not the issue. It is the comparison. And those log errors with functions are normal, they appear as no events are ran because comparisons at the start are false.

  • I assume you mean debugger breakpoints? I have no idea how to set those, as I assumed they would be under the System object but couldn't find any breakpoint events :(

    Right click on event block and you can toggle breakpoints. I still prefer Browser -> log messages though :)

    The error in function call is because no events are ran (comparisons prevent that). It's normal, no reason to get worried :)

  • Here is a quick debug 101 for problems like this, or how I would approach finding out what is wrong.

    First, add log messages. This way you can easily see what is happening during runtime (the debugger has tool that can do similar stuff, but I am a bit old school). These log messages are displayed in browsers log and tell you what exactly is going on in your variables.

    <img src="https://dl.dropboxusercontent.com/u/19921470/debug2.PNG" border="0" />

    Here is the output:

    <img src="https://dl.dropboxusercontent.com/u/19921470/debug.PNG" border="0" />

    This suggests your problem is related to the second comparison in the event.

    Another thing: It seems you use separate functions (copy pasted?) for AI and player movement. It's generally bad practice to copy paste same code to two places, and you should look for a way to use same functions for AI and player programs if they do the same thing.

    And also; commenting your events is very, very useful when you come back to your project after two week vacation or show it off to people in the forums :P. I generally write short comment above every function about what it should do, what do the input variables mean and describe any return variables. At least for me this is a must, that way I don't have to spend anytime wondering what these events do :)

    Hope this helps, your game keeps getting better every time I see it!

  • Um, im 14 so idk but I dont get why people say program when you dont code with construct

    That's semantics; whether you click on things or type them on keyboard your end product is the same.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's pretty standard system to show all variables available in the current scope. I'd recommend you start using more local and instance variables, I rarely use any global variables as it's generally bad practice :)

  • Great post! :)

vee41's avatar

vee41

Member since 12 Apr, 2012

None one is following vee41 yet!

Trophy Case

  • 12-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

14/44
How to earn trophies