99Instances2Go's Forum Posts

  • That is true, in the end it is all picking and a little logic.

    But, for the beginning C2 has a whole pack things in place to reduce the amount of code from the start.

    Instances, families, containers, animations .... functions.

    Each one and every enemy can be 1 sprite and its instances. You will be surprised how much lines of code (including functions) you will not have to write. Although, it is mainly copy and past with replacing objects.

  • I make you a example later, tomorrow, day after. And i promise you, it will not have a lot of code.

  • There is a behaviour and a plugin to deal with the creation problem (both work together). It allows you to create an object by name/variable.

    Give it a try. Its another, awesome, always updated plugin by

    For the variables. The above method from Brandon12hummer sounds rock solid to me. But, for my lazy world, it is still a lot of work.

    You can also make base dictionaries (yeah 120) and bring them in a container with the object. Now, every time an object gets created, its Dictionary gets created. Same for destroying. Pick the object, and the Dictionary is auto picked. That is gonna make a lot of Dictionarys , but you do not need to keep track of them, the system does. The debugger tells you wich Dictionary goes with wich object. Just an idea.

    From there, you can take it a step further. Add them as .json files to your project. And load them to the Dictionary during start up with Ajax. Balancing the game is now a matter of just editing the .jason files.

    A Dictionary is pretty easy. It is a key and a assigned value. You dont need to remember indexes, as in the array. The values are located at a key. The key is a string like "Health".

  • First things first : Units.

    In c2, speed is usually expressed in pixels/tick or pixels/seconds. Two different units.

    The speed (expression) of bullet behavior (look in expressions panel) is expressed as pixels/second. There is a very important thing that comes with that knowledge. Wherever you see 'pixels/second' it means that this speed is already frame-independent.

    So what ever solution, it must be frame-independent too. Else, you could have it right on your computer, but on another device it will be totally wrong.

    If you gonna rotate it like ...

    Every tick > rotate 1 degree clockwise

    You will have to frame correct it like

    Every tick > rotate 60 * dt degrees clockwise

    Now, if we take a look at the Rotate behavior, its speed (expression) is also expressed as pixels/second. Meaning, the Rotate behavior is also already frame-independent. Well, why make it difficult, lets use it.

    Ok so .. Speed is distance/time.

    The distance a circle makes in 1 rotation = 2*R*pi.

    R in this is the radius. 2*R is the width of the wheel.

    So it is 'width of the wheel' * pi.

    The same speed would be when car.bullet.speed (pixels/second) = Wheel.width * pi (pixels/second)

    But, we need this in degrees/second

    1 degree = a distance = Wheel.width * pi / 360 (pixels)

    so

    1 / (Wheel.width * pi / 360) degrees = 1 pixel

    or

    360 / (Wheel.width * pi) degrees = 1 pixel

    For any pixel

    x * (360 / (Wheel.width * pi)) degrees = x * 1 pixel

    Say x be the car.bullet.speed

    car.bullet.speed * (360 / (Wheel.width * pi)) degrees = car.bullet.speed * 1 pixel

    So .. to have the same speed, you give the rotation behavior this speed :

    (car.bullet.speed * 360) / (Wheel.width * pi)

    I am not that big of a math brain, hope its right, so from the head.

  • Bah, that is only the little first step. I was thinking. Mayby you should lerp to (constrain to) only 8 angles. Else you got the user to able to 'customise' in every angle. Each frame you want parts to be clickable you need sprites (collision polygons) to click on. For each possible angle thats a load collision polygons animating in sync with the main frames. That is some work to do.

  • I would set the animation speed on zero.

    And code the forward/backward changing in frames. In basic it is just setting the frame to a variable.

    A variable that is steered by touch/mouse.

    I think that 36 frames is a little small. It will not be fluid.

    Is this helping ?

    https://drive.google.com/open?id=0B1SSu ... 09IZF91MnM

  • For (1), you should be able to do that now (based on example), for (2), it does that already.

  • Well, when using containers, picking is done for you. No need to keep track in arrays and those things.

    Pick one in the container and the picklist contains all from the container.

    Also, destory/create one, and you create/destroy all.

    https://drive.google.com/open?id=0B1SSu ... EpWdWI5Nlk

    Only 1 little downfall, you have to create them during runtime. But that is pretty easy.

  • In my opinion, it is easyer to use the LiteTween plugin.

    behavior-litetween_t70700

    But, that is not your qeustion. So, let me try to give a good answer.

    First of, i am aware that mostly lerp gets used with a dynamic start point, a static endpoint and a static lerpfactor. A lerpfactor that has to be dt corrected. And that is not really easy.

    This way the next step gets smaller and smaller (but never zero), giving some (in my eyes fake) feeling of smoothing out. But, you will have to when the target is moving. That is (if i understand right) not you case.

    So, under the condition that the target is not moving, lerp can be used in much (again in my eyes) better way.

    Basically using a static start, a static end and a dynamic lerp factor (that is already dt corrected in the right way)

    Besides that. there is not only lerp, but also qarp and (very usefull) there is cubic.

    In this example i use cubic to easy-in and easy-out a movement. I kept it as 'visual' and as 'simple' as possible.

    Look at the imagepoints on the ruler.

    https://drive.google.com/open?id=0B1SSu ... nZReFFzWEU

    Hope this opens your eyes to new ways. Greetings.

  • Using containers. It is designed for those things.

  • It is a bit weird that you obvious think that the layout does not matter.

    Your blocks are 60 pixels square. So allow me to gamble that the row grid is 60 pixels. Just glancing at the field i gamble that there are between 18 and 21 visible rows. Yet, your identifier jumps in a 120 pixels grid that has only 14 rows.

    And if there is some logic in all that, then it is also save to gamble that you made that identifier 120 pixels height.

  • Guess you can not remove the mirror because of the imagepoints.

    But, check in the debugger. The animation is playing. But since you mirror the GoLeft annimation it looks the same as te GoRight animation.

    Go to the sprite&animation editor. Mirror the complete GoLeft animation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Start with the Graphics and Animations. Bring them in C2.