Freddy33's Forum Posts

  • Hey bud, thanks George. I am going to play around with this because I never even thought of calling an instance variable with a function. I can see how that would make things easier.

    I guess I struggle with where to put the function as well.

    Because the function can go in a condition, sub condition and even an action!

  • My whole code is messed up. Its a total nightmare. It will work, but I have to go through everything and make adjustments.

    Building a game is hard man.

    Thanks dop

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Now you are adding 0 (zero) to the ammo, why?!

    see this example, you can open it in Conctruct 3:

    https://www.dropbox.com/s/9tml5fo5gqzoblv/ammo_test.capx?dl=0

    Thanks for that example dop man. I have studied it and it makes perfect sense. I see how it works.

    Somethings not right in the game, Its not working when i put it in. I will work it out. I think its colliding with some other stuff that going on. Thanks for your patience and thanks for a great example, that was quality"! :-)

  • Why do you have param(8)?? It should be param(0) for the first parameter, param(1) for second parameter etc. 0 is the index of the parameter, not the number of bullets.

    Also, I have no idea what's happening when you fire a bullet, this isn't in your screenshot. In theory you should check if ammo>0 and subtract 1 from ammo.

    Lol, god Dop, I have no idea? I am totally spun out about this. I honestly dont whats going on anymore. Its so messed up. Basically when you push the shoot button it spawns an arrow. But I just want it so at the start of the layout it adds to the arrow text (capture 2)

    Cheers Dop :-)

  • Thanks Dop, It does set the ammo but when I fire the arrow the ammo drops to minus 3.

    Not sure why, But I will just stick with setting it at the start. Cheers buddy

  • Yes, you can pass any number of parameters to functions, and access these parameters inside the function using Function.Param(0), Function.Param(1) etc..

    So in your case you can call function "AddAmmo" with parameter 6, and inside the function use "Add Function.Param(0) to ammo"

    Hi dop, sorry for being a layman, Is this the right way to set up the function. I have tried a lot of different ways but nothings working.

  • Cheers Dop, I will give that a go and see how it works :-)

  • Hello, Finally I am making good use of functions. I used to fear them but now I love them. However, I know there is more to them than I know.

    Basically, rather than repeat this code on every new level, is there a way to use a function with a param instead? Not sure how to go about this. (Or if it can be done)

    Thanks for the help!

    Tagged:

  • You do not have permission to view this post

  • You do not have permission to view this post

  • You do not have permission to view this post

  • Cheers plinkie, I will be sure to do that. :-)

  • Yeah, this is true Plinkie. I will change that tonight. Does adding more code use minimal memory.

    I'm terms of the end of level I was going to use a boolean.

    Something like,

    At end of layout, and lock 1 has booleen, set to true.

    Destroy lock.

    If boolean is true, and level 2 in touched, then go to level 2.

    Thanks plinkie