worm1's Forum Posts

  • Thx BadMario for your explanation, it's a basic rebound that I wish so if I do not need the angle and I change the x and y depending on the side of the box touched, my question is how we determine the side hit ? thank you !

    I find this formule from an old game in AS3 ( flash game )

     // hold our ball position
        var bx:Number = _main.mcBall.x;
        var by:Number = _main.mcBall.y;
        var br:Number = _main.mcBall.width * 0.5;
    
        // get our bounds (assuming that the brick has it's registration point
        // in the center) - extend by the radius of the ball to cover the points
        var left:Number     = this.x - this.width * 0.5 - br; 
        var right:Number    = this.x + this.width * 0.5 + br;
        var top:Number      = this.y - this.height * 0.5 - br;
        var bottom:Number   = this.y + this.height * 0.5 + br;
    
        // check the position of the ball in relation to our brick
        if( ( bx >= left && bx <= right && by >= bottom ) ||    // bottom
            ( bx >= left && bx <= right && by <= top ) )        // top
        {
            _main.mcBall.ballYSpeed *= -1;
        }
        else // hit the left or the right
        {
            _main.mcBall.ballXSpeed *= -1;
        }
    
    [/code:2j92k98u]
  • To be clear with my problem i post the file of my collision engine and i repeat that i can t use any behaviors of construct 2.

    worm1work.alwaysdata.net/test/test_collision.rar

    And what i try to do for the bounce off it's to convert my angleofmotion to have thoses results :

    0 degrees = (1,0)

    90 degrees = (0,1)

    180 degrees = (-1,0)

    270 degrees = (0,-1)

    And after i can invert direction of the bounce change x y to 1 or -1

  • Hi

    Look at this

    scirra.com/forum/viewtopic.php

  • Hi

    I want bounce a ball on differents rectangular boxs without behaviors because i need to keep the x/y variables and then pass them through a relocation pass before the ball is drawn to the screen...

    So i move the ball with :

    System every tick - ball set X to Self.X+Self.speed_x*dt
                                    - ball set Y to Self.Y+Self.speed_y*dt
    [/code:mnqr0lnu]
    
    I have the angle of motion of the ball with a function that i create.
    
    For the collision with a box i use :
    
    [code:mnqr0lnu]
    Ball is overlapping box 
    [/code:mnqr0lnu]
    
    Now i don t know how to use the angle of motion to bounce off the ball .
    I try to reverse x y coordinate with 
    
    [code:mnqr0lnu]
    X=cos(angleofmotion)
    Y=sin(angleofmotion)
    [/code:mnqr0lnu]
    
    But the result is not very correct , the ball bounce off but not very realistic..
    
    Thx for help
  • If I could handle the collisions by manipulating only x and y it would go

    But I think it's the function iso move to offset that I do not finally understand

  • Ty but if i do that and not use "Iso move by offset" to move the bullet the z-ordering not work anymore ;(

  • Hi , thx for reply R0J0hound

    I have a new problem with our behavior and custom bullet movement with angle of motion collision in isometric world.

    Exactly the same problem that this post :

    I make custom movement of bullet with :

    Iso move by offset(
    Self.random_speed*cos(angle(0,0,Self.random_vx,Self.random_vy))/distance(0,0,Self.random_vx,Self.random_vy)*dt,
    Self.random_speed*sin(angle(0,0,Self.random_vx,Self.random_vy))/distance(0,0,Self.random_vx,Self.random_vy)*dt,
    0
    )
    [/code:11hm8cps]
    
    And when i hit something 
    
    [code:11hm8cps]
    Iso overlap at offset(0,0,0) - Set random_vx Self.random_vx*-1
                                                   - Set random_vy Self.random_vy*-1
    [/code:11hm8cps]
    
    So the bullet go well in the opposite direction but with not the correct angle actually.
    
    I try to add bullet behavior or add anothers plug in like rex_pixel-collide with your plugin canvas to detect angle of collision and add it and the custom movement but nothing work  I search for a solution very simple too but I do not find... Thx if you coudl help me a little .
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi

    I'm coming back after having made good progress on my isometric game thanks to you R0J0hound <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

    I'm now stuck on something and I need your wise advice to handle this :

    worm1work.alwaysdata.net/test/snake_zorder.png

    worm1work.alwaysdata.net/test/snake_zorder_2.png

    As you can see I created a snake as in this game :

    youtube.com/watch

    The snake's head has the iso behavior and is work very fine in the isometric world. For the tail of the snake I tied sprites with the pin behavior (rope style) . The movement of snake is as I wish but now the big challenge it's about managing the rest of the body in the isometric world ^^

    So my question is must I add to the sprites of the tail the isometric behavior too ? Or must I handle z ordering z ordering with the informations of the head ?

    Thanks a lot for your help

  • Thx for explanations R0J0hound !

    Now i explore others options of your cool behavior and i have a little problem with the function "position shadow object".

    My idea is to position a shadow below all my blocks of sprite to simulate shadow caster so i try to do :

    system - for each Blocksprite system - create object Shadow

    Blocksprite - position object Shadow as shadow

    But the system create infinite Shadow ^^

    Ty for help me

  • Hi ,

    Very good behavior R0J0hound !

    I start to make a fake isometric game like :

    youtube.com/watch

    After searching what techniques would be best on forum and internet, i think our approach of z-ordering is the best.

    I have just a question. As you can see the movements in the example game is on height directions,so i add 8 movements behavior but i don t if it s the most perfomant method with our behavior ? Any ideas ?

    Ty for replies !

  • I have same problem that . The effect work fine in localhost but when i export the project the effect bug ;(

    Any ideas ?

  • Problem Description

    I use a dropshad effect that work fine in construct 2 but when i export the project the effect bug

    Any ideas?

    Ty

    PS: I try to put a link of screenshot into the post but the submit bug with it...

    worm1work.alwaysdata.net/test/effect_bad.png

    worm1work.alwaysdata.net/test/effect_good.png

  • Thx a lot , very nice solution !

  • Hello

    I have a sprite with 3 animations where I put the letters Y, E and S

    I create a random letter every 2 seconds with

    set animation to choose("O","U","I") (play for beginning)

    Then I make it fall and I have another sprite that must recover it to constitute the word yes to earn points

    I created a variable instance for the sprite of letters but I do not know how to store the return of the function to choose to say that it was letter

    Thank you for your help

  • Hi , i need to save lot of values in a 2 dimensions array .

    I use this method :

    define and array of x: 100 y : 3 z : 1

    to save values :

    Array > for each XY element > Array > Set value at

    (Array.CurX, Array.CurY) to

    tokenat("1,A,1,2,B,3,3,C,3 etc...", Array.CurX +Array.CurY*Array.Width, ",")

    I don't know if i do the good method because i want with my array forexample return 1 like UID,A like a texte and 1 like a value.

    So my two questions :

    My array has the good structure ?

    How can i get my values into 2 dimensions ?

    Ty a lot for helps !