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