Guizmus's Recent Forum Activity

  • Hello creamcakes

    You should use 2 things :

    • the events "on start of layout"/"on end of layout"
    • tags for your sounds.

    At the start of layout, start playing soundtrack with tag "soundtrack".

    At end of layout, stop playing "soundtrack"

    (those are actions of the Sound object)

    If you add a global variable in each layout, variable containing the name of the soundtrack, you can just have those 2 sound events in every layout , just using the variable to play the wanted soundtrack.

  • Hey hdnine, and welcome around here !

    First of all, having a background in JS too, I went through the same at first. The first thing you shouldn't do is try to find a direct link between how you would write it in JS and in C2. It's not the same and you won't be able to do it like this.

    My first tip on your problem is : you cannot change a fade time during runtime. When you create your objects, you have to add a behavior Fade on it, and set its time to fade in and out from the editor. If you want to have a fade in AND a fade out, but not at the same time, not triggered together, just add 2 behaviors Fade to your object and set them to respectively fade In and fade Out. You can rename behaviors too, to make it more readable.

    Then, you will be able to write a function "ToggleFade". Here is a sample capx to show how I would do it : capx

  • Ashodin

    The XML plugin is your friend here, but the file could be a lot bigger than just a text file.

    Have you tried to just import a txt file, load it via AJAX, and do a "for Each" on the tokens if you use a "," as separator ? Something like this. You can then store it in whatever you want, an array could be nice.

  • hello benadamswoo

    If I understand right, you want the player to click all the sprites in order, switching them to frame 8 if the player clicked the right one (the lowest in the array).

    I would change a lot in your capx to make it more flexible, but to just solve the current problem, the simplest way would be to rewrite the value of RND.At(clickedSprite). If you put, let's say 100, inside, it won't be the lowest one anymore, and will let other sprites get clicked then.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I never saw any tutorial on the subject, but there were some threads discussing this already if you do a little search. It's not that hard in fact, the harder maybe being the AI itself of the little guy : how will he react if he wants to eat and to sleep at the same time for example. There is a lot of decisions to be made to have a good game concept here. I recomand that you try to put the more you can on paper first, just to have clear ideas.

  • Basilboy

    Platform can be the way to go in your case, but a lot of adaptation should be done for the controls. First of all, deactivate the default key mapping. You will then need to make a big event where you check on current inputs, current animation of the sprite, and change the animation according to inputs. Then, you can use the "simulate controls" action of the platform behavior to control the movement of your sprite.

    It can be a lot of work for lots of animations though... I would personally do multiple events like "If left key input -> if currentAnimation = left, simulate left, else play left animation", ...

    It all depends on how you want to map your controls then.

    basicUser

    Don't use other people thread for your own problems, create yours. That said, you need to give more infos. Construct 2 will send your datas without problem using the "AJAX" plugin, and the problem is most likely in how you use this plugin, or in your server.

  • I think the pathfinding isn't made for finding paths outside of the layout. If it was, that means that a sprite could "choose" to go from A to B in a maze by running around it ^^

    That said, you have 3 solutions.

    First, you can make your layout bigger, letting them spawn inside the layout. You just have to set the scroll to the center of your level, so mobs spawn can't be seen and it looks like they walk inside the layout.

    Second, you can, after a mob spawns, make him walk inside the layout first and then look for a path to the destination.

    Third and last, you can change the spawning point. I just moved the "origin" point of your spawning zone and it works nicely right now : capx

  • You should link a capx when you have a problem you want help with, people can help you more easily and you will have more answers ;)

    If I understand well and your only problem is to reset both instance frame to 0, you just have to add a new event, using the "compare frame" condition on the sprite, just to compare it to 1. This event will select both sprites with frame number 1. You can then change the frame back to 0, if all your other conditions are verified.

  • Without the capx it's hard to say.

    Still, there is something that makes me wander : In the event 2, if the dt is too small (usually the case), the volumeMusic won't ever change from one tick to another because of the round. Why ? Because you substract like 0.2dB, then round it, making it the same again. Just try without the round, you can use floats as volume attenuation.

  • Toby12

    No problem :)

    I didn't optimize it though, as it was just a sample. If you add this on a lot of objects, be sure to use the scale instead (scale = height/width) with th same trick, initialScale being then a variable on your button. Less variables = better :D

  • Doesn't look possible right now, as there is no action doing it ^^ There are always workarounds like multiple spritefont with different align, and a variable to know witch is witch when you want to display text (so you interchange the spritefonts) but it's quite rare to need to change the alignment during runtime, no ?

  • random(1,3) outputs a number from 1 to 3, but with the random, you will never have 3 exactly, at most a 2.99 for example. When you cast it as an int, you don't do a "round", you take the int part of the number, making it a number between 1 and 2. What you want is this :

    ArrayAt(round(random(1,3)))

Guizmus's avatar

Guizmus

Member since 26 Mar, 2013

None one is following Guizmus yet!

Trophy Case

  • 11-Year Club
  • x4
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies