Few questions.

This forum is currently in read-only mode.
  • during development i ran into some problems that arent totally covered in wiki or tutorials. so I am asking you now .

    1. I want to make semi-procedural destruction for props. Now i think that my sprite (small cube) should spawn at death four copies of itself scaled down by half. I need to know how to spawn objects in specific position and dimensions.

    2. How to compare speed of simulated sprite on the collision event?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • to spawn sprites in specific locations with specific dimensions

    System : Create Object (let's you specify the location)

    Sprite.SetWidth

    Sprite.SetHeight

    actions after an object is created, and in the same event will apply to the object that was just created

    if you're using behaviors to move your sprites, most behaviors have an expression for speed,

    for instance, Set private variable MyCollisionSpeed to

    and then double click on the sprite, and click on the behaviors tab to find the expression for speed

    if you're using your own movement method, and no behavior, the way to determine speed is to set up two private variables, previousx, and previousy

    if you need absolute speed, or the specific x and y speed

    always

    set absspeed to distance(previousx,previousy,sprite.x,sprite.y)

    set xspeed to(sprite.x-previousx)

    set yspeed to (sprite.y-previousy)

  • Thanks lucid for fast answear! That knowlege should be in wiki anyway . (if it is - im dumb).

    Edit: Another problem, oddly physics behaviour doesn't have expression for speed, guess i had to do that the other way.

    and the "distance" doesent work for me. simply theres no command like this.

    and how to setup those previuosx/y variables? just make them or insert some code ?

  • there is a command

    just type distance(somethingx,somethingy,somethingelsex,somethingelsey)

    and sorry

    at the end of that example I gave you

    previousx = sprite.x

    previousy=sprite.y

    previousx and previousy being private variables you made

    also,physics does have an expression for speed

    this won't do anything, but just to help you find the expressions, do something like

    sprite - set angle

    instead of typing in a new angle, double click a sprite with physics behavior, when it brings up the list of expressions, click on the physics tab, that's the list of physics expressions

    velocity x component and y component

  • Thanks alot! Now it's working .

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)