Results 1 to 10 of 10

Thread: Shooting at the Player

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Super Vegeta , thank you!

    Now that you told me , it makes sense ... and a lot of sense. Especially the disk io part . My game hangs for a sec when the Music changes.

    I Need to rewrite the functions.

    Load all Sound and Music effects on Startup . And then just Play the appropriate channel instead.
    So if a Bullett is shoot by 5 different alliens instead of wasting disk i/o I just Play the channel from Memory when needed.


    Thank you for this great advice!!!

  2. #2
    Hi all,

    Just wanted to post, I managed to solve the bullet calculation . Not alone unfortunately... google helped. And I don't understand it 100%.... I think I may end up taking private Math Classes

    Code:
                        vx := (PlayerSprite.X+(PlayerSprite.ImageWidth/2)) - (Self.X+(Self.ImageWidth/2));
                        vy := (PlayerSprite.Y+(PlayerSprite.ImageHeight/2)) - (Self.Y+(Self.ImageHeight/2));
    
                        len := sqrt(sqr(vx) + sqr(vy));
    
                        vx := vx  / len;
                        vy := vy / len;
    
                        Bullet.Direction:= vx * 4;
                        Bullet.MoveSpeed:= vy * 4;
    What happens here is the vector lenth is calculated... then normalised , I understand what it does... goes from 0 to 1 .... but this formula is something I would have never figured out

    Also I realised my mistake...I need to alter the speed on both X and Y axis in order to work perfectly ... it even shots backwards...

    Greetings...

    ps.: I dont have any new material, I have level 1 done... altered the background, enemies use different attacks... level 2 is done..it turned out quiet cool... level 2 ending is done
    It took a while to come up with a crazy story... Its god damn hard, but I will try and not post anything until done....4 more levels

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •