monitz87's Forum Posts

  • Here you go... far better - lol

    That was pretty clever

  • I'm guessing that what you're trying to do is create a solved Sudoku array by simply generating random numbers onto every position until they no longer conflict with the Sudoku rules.

    There's a whole bunch of problems with what you're doing.

    First, your While loop gets stuck whenever arrayXinc = Array.CurX and arrayYinc = Array.CurY, because the while condition tests if the array element is equal to itself (which of course is always true), so you get an infinite loop.

    Aside from that, generating a random number in a slot until it 'doesn't break the sudoku rules' and then moving to the next is not a valid Sudoku generating algorithm. You will undoubtedly reach a point where there is no possible number for the current slot. There are several Sudoku generating patterns out there that you can use, but in the mean time, I suggest you simply pick a set of pre-generated puzzles and store them statically in arrays. Work out the gameplay side of things first and then focus on how to generate your own puzzles. It's not a trivial matter.

  • you can use global variables in expressions

    you could just do

    LifeBar set animation frame to Lives

  • Upload your capx, we don't have nearly enough information to work with

  • You can use a variable to track the current index:

    currentIndex = 0

    set text to array.at(currentIndex )

    when the player presses a button:

    add 1 to currentIndex

    set text to array.at(currentIndex )

    An even more elegant solution involves adding a "currentindex" instance variable to the array object, in case your game logic involves keeping track of many conversations (stored in different array objects) at the same time. In that case, you use

    Set Text to Array.At(Array.CurrentIndex)

    Array Add to CurrentIndex 1

    It's much more mantainable and in my opinion a better solution to your problem

  • First of all: what do you mean by "text based game"? Do you want to make some kind of "choose your adventure" game? Or one of those "type what you want to do" games?

    If it's the former, then I think construct (while not the best option) can be suitable to your needs. If it's the latter, then you might do better with a more code-oriented framework.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just FYI, I think this topic is covered here:

    While that tutorial is extremely helpful, it doesn't solve this particular problem, because the "Create limited revolute joint" action on the Physics behavior takes an 'object reference' as a parameter, which you don't have when using the solution the tutorial proposes.

  • Thanks, I'll keep that in mind

  • Hi everyone,

    With a graphic designer friend we're building a dual illustrator/construct2 course aimed at high school students in order to teach them the basics of videogame design. Our general goal is to provide a fun experience for the students more than breed a generation of top level game designers, so we want to keep things simple.

    We have decided on the following format: On the first class we show the students a complete game to showcase the power of the engine. We then show them a simpler game which they might be able to build, and thus set the goal for the end of the course. We alternate between illustrator and construct lessons. Each lesson should be designed to answer a group of key questions, all hopefully building towards completing the game, and we had this idea that whenever one of us is teaching his lesson, the other one sits with the students and directs the flow of the lesson by asking the current teacher each of the key questions. This serves a double purpose: It gives the lesson an interactive feeling while keeping the course's structure, and it makes students see that it's ok to ask questions whenever they have any doubts.

    The purpose of this post is to ask for your opinion on the format of the course, but also to ask for ideas on what the scope of it should be.

    • How technical do you think we can be without scaring the students away?
    • Which concepts do you think constitute the 'heart' of the engine?
    • What type of game could showcase all of those concepts while still being fun?
    • Most importantly, what type of game can be designed while following the 'key question' format and make it seem like a natural process?

    We want to make the students feel as if the answers to the questions are the building blocks of the game we're making.

  • Families have nothing to do with instances. You have a Family now, You can make a second duplicate, and it will work the same way.

    It depends... You can't actually duplicate a family if it has family instance variables. If, in his example, the "Placed" variable was an instance variable of the "Placeable" family, then he can't duplicate the family to use that trick, because objects can't have 2 instance variables of the same name, so the second family can't have the "Placeable" instance variable, and then you won't be able to access the "Placeable" variable of any object in the duplicate family.

    The OP's problem is actually one of the reasons why I suggested having aliases in Construct 2 (topic: scirra.com/forum/construct-2-general_f146 but Ashley already dismissed my idea because of performance issues. Maybe if the engine supported somehow assigning object references to local variables, or some kind of "ObjectReference" plugin which serves the same purpose.

    In any case, OP, how did you sidestep the issue? It would be useful to know for future reference

  • I think you have a slight confusion about how actions work. Actions run only once per event, but they run across all objects of that action's 'object type' that were picked by the event conditions. Your event picks all workers which are overlapping the selection box, but only picks one instance of the function object (because there is only one) so it only runs the call function action once, because call function is a function object action, not a worker action. It would be the equivalent of having the function call in a blank sub event, so that's why you need the foreach. It would be different if somehow objects could have functions as instance variables, because then you could call the function as a worker object action and skip the foreach

    It's not so obscure as you may believe, you just need better understanding of the event system

  • pirx, Yes collisions affect clicks - lol. That is the hitbox as monitz87 says. But it isn't a solution as you usually want the whole button to be clickable.

    I never suggested altering the button's collision polygon, I just said he should disable collisions on buttons which belong to invisible layers (and enable them when the corresponding layer becomes visible), so they don't register "On Click" events, which would basically solve his problem.

  • This doesn't seem to work, at least not with the MoveTo behaviour - the enemies still just run right through each other. I could try and do it through CustomMovement instead, does that definitely work?

    I think we need more information. What exactly "doesn't work"? Which solution did you implement and how? AFAIK, you can change the target coordinates of MoveTo dynamically, so if the event which makes enemies follow the player is a base level event, you should just adjust the MoveTo target every time the force fields collide with each other.

    HOW you should adjust them depends on the AI you want to implement, but a simple suggestion would be to make them move in an arc using the player as the circle's center (the angle of the arc would be an inverse function of the distance between the player and the enemy, so if two enemies 'get too close' far away from the player, they just step aside and keep marching towards the player, but if the 'getting too close' is closer to the player, you get a bigger arc and so the enemies seem too surround the player)

  • DUTOIT

    monitz87

    I don't think collisions affect clicks but I might be wrong. Disabling groups will be subject to the same problems as in the picture in my previous post. I've tried that. But I will have a look at this .capx!

    Actually, after I posted my reply I had the same question: "do touch events take hitboxes into account or the actual sprite image?"... I think it is worth testing at least.

    Groups should be different because you can put all the events involving a certain layer into a group, and disable said group when its associated layer is invisible, so you won't get those 'my click triggered events on various layers' problems, because all events on an invisible layer would be disabled.

  • The problem is, I need to be able to calculate like if sign(x) = sign(y) then A else B. And I like to be effektive, so trying to keep things short

    After Posting, I exactly figured the workaround of Zhon, that works well of course, since I only need the function for just one value.

    If I needed the function often in the script, I might use monitz87`s solution, though I am not sure how to do that in an effective way. I think that could become a bit complex, which makes it only worth to implement, if you need it all the time for a lot of different variables. Still a great solution, also I did not know at all, you could do that. So this Answer was very, very useful

    Thanks for the quick and helpful replies!

    The bottom line is, whenever you are 'coding' in construct, there will be some times when you will think to yourself "god, how I wish I could just use javascript/python/C#/whateverlanguage and just tell the engine exactly what I want to do". AFAIK, the engine has a workaround for most of these cases. Scirra is working towards a Framework that will allow developers to never hit that hurdle, but in the meantime, you can stick with what you've got.

    As far as workarounds go, implementing your own sign expression as a Function is pretty straightforward, although I fully understand how just having sign(x) as a system expression would save you a lot of time