Guizmus's Forum Posts

  • Here is the capx for the method I described. Works with any frame count. Functions can easily be changed to accept multiple instance of the sprite (just add a Sprite.UID argument on each call)

  • You should provide a sample capx describing your problem for more efficient help next time ;)

    To start with, how do you do your shoot ? Did you add a turret behavior on your character ? How does your bullet move ? With a bullet behavior ? If so, you have to change the "angle of motion" of the bullet when you spawn it.

    For this, do something like that : <img src="http://imageshack.us/scaled/landing/46/enk3.jpg" border="0" />

  • SigmundO

    First of all, your game looks nice ! I would love to see it finished :)

    Then, I got it to work quite simply. Your problem is a misuse of the function tokenAt. First parameter needs to be a string, and you give it a number. If you just add a "str()" around it, it works, like this :

    tokenat(str(Score), NumbersArray.Indeks, "")

  • You want to cycle randomly between the frames ? I would use a instance variable "framesToDisplay", initialy set to "0;1;2;...;x;", x being the frame count, and every time I need to change the frame, I would set the frame to round(random(tokenCount(framesToDisplay,";"))), and then remove the frame number from the variable. Once there is no more token (every frame has been used), regenerate the variable.

    As you will need to store the frames still to show, or the ones already shown, I don't think there is a solution without variable.

  • I'm not sure this is exactly what you need, but I needed to access global variables in some evaluations, but the variable name had to be a string parameter. So I wrote a mini-plugin doing just this, picking a global variable and returning its value by using a string as "variableName".

    Here is the plugin and a sample capx describing how it works.

  • Hey !

    What a nice post, explained, clear, .. everything !

    Let's try to answer.

    Just to start with, I'm also a "new full C2" user, and I've played around and found some of the same problems you did. Here is what I found :

    1/ Ennemy_type

    Let's talk about your function "onHit". You have to understand the picking mechanic here. As you didn't pick anything, everything is picked. All ennemies. All zombies and all purple sprites. The first action is then applied to all zombies that have "ennemy_type" set to 1 (so all zombis), and then the same appends for the purple sprite.

    So first, you have to pick your ennemy. How? By UID. Use ennemy.UID as "onHit" argument when you call it, and add a condition "Pick Ennemy By UID (Function.Param(0)) at the start of the onHit function.

    Then your 2 events (36 and 37 in the screenshot) will work, just replace "Zombie" and "Sprite" objects with "Ennemy" family.

    Having an ennemy_type variable is useless in this case.

    2/ LoS

    This one is going to be quick. Don't use a family for this. Don't use a container. Use the new "line of sight" behavior (introduced on r134, start of this month).

    3/ Instance Variables

    First of all, your icon visibility setting can't work like this.

    For example, whene the event 24 is triggered (zombie alerted, overlapping roof), you set the icon invisible. But at the same time, the event 23 is triggered, so you also set it to visible, every tick. Try to use sub events, like this

    Zombie IS ALERTED :

    • Zombie is overlapping roof, roof visible : set invisible
    • else : set visible

    Same goes for LoS (events 26 to 28)

    Next, you have to pick the ennemy in your function here too ! event 21, add a condition "Ennemy : pick by UID", and use the Function.Param(0) to specify the ennemy UID.

    I don't have time to go in the capx right now, but I will try to help more tonight, it can work, just need some more debug :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Quite easily !

    Event : List->On selection changed

    Action : Call Function List.SelectedText

    If you create an event "on function XXX", XXX being the text of each of your options, you will have the respective function called when the user change the menu selected item.

  • Really nice thinking !

    I'm training myself on a TD also these days, and I didn't think of writing another turret behavior. Instead, I was checking for multiple enemies in range, ... and was crying over the basic turret behavior.

    Anyway, I really like how you worked on the rules of your game, choosing tower priority is not something available in every TD.

    Finaly, those sprites are really detailed. This all looks great, I'm looking forward to read more of your devlog :)

  • Shapter Ok, so the problem is that you try to assign a value to the array in a "ForEach in the Array" condition, but the value isn't accessible right now : you have to do your assign in the "ForEach in the XML" condition.

    Here is the same example, working. I deleted what wasn't useful.

  • If you really made 3 animations (white, fadeIn and fadeOut), you are storing frames for nothing. Use the "Fade" behavior on your sprite. To be exact, use 2 different "fade" behavior : one for the fadeIn, one for the fadeOut. On start of layout, run the fadeOut. On function "nextLayout", call the fadeIn and use the event on end of fadeIn to trigger the real switch to next layout.

    Also, if it works perfectly on the first layout but not when starting on another layout, try to export your project to see how it does. If you preview from the second layout, thinking the sprite would be in a specific state because first layout should have set it that way, the result won't be what you think. Running from start should help test more precisely.

  • Shapter You should put the file public, can't access your capx ^^

  • KMOBridge

    Hey again !

    I worked on your dropbox link, and there was already the bullet behavior, yes.

    You seemed to have some difficulties with the diferent controls though, and what you described could have been done with a lot of behaviors, like 8 directions, custom movements or bullet. I did all 3 in this example capx, with a menu to change the input type. Take a look at the event sheet to see how to use each controls well in you case.

    If you have any questions, don't hesitate to ask !

  • There is a new behavior since r134 that does that for you : line of sight. There is also an example doing exactly what you describe in the example folder. Its name ? "line of sight" !

    Enjoy :)

  • First of all, if you want help fast and useful, you should explain more what you need, and never ask someone else to do it for you. The point of the "How do I" forum is to learn by asking others for tips, not for the complete job.

    There is no example called "catapult", but there is a lot of physics examples that could help you too.

    That said, let's just think about what is a catapult and how to do it.

    There are 2 part : the catapult and the boulder. Catapult is a simple sprite, playing an animation when you click the "lanch" button, or whatever the event is in your case. The boulder is a sprite too, with physics. When the catapult lanches it, just apply a force on the boulder, depending on the settings you want for the catapult.

    Here is the simpliest capx I can think of to demonstrate this.

  • You are nearly there already ^^

    One thing to change only : don't set the bullet speed to 10, set it to (10-joe.Bullet.Speed).

    This way, if you are already moving, you will stop, and if you are not moving, you will start :)