Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Running something in backround?
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Alex C.




PostPosted: Sun Jan 22, 2012 12:19 am   Post subject: RE:Running something in backround?

yeah but how many times does the character move in that loop.... once... smae with the missile! Very Happy
Sponsor
Sponsor
Sponsor
sponsor
bc123




PostPosted: Sun Jan 22, 2012 12:24 am   Post subject: RE:Running something in backround?

ahh, well where should i try putting the missle animation? above all the if key ???
bc123




PostPosted: Sun Jan 22, 2012 12:35 am   Post subject: RE:Running something in backround?

Okay, so i tried this,

x3 := x3 - 10
x4 := x4 - 10

delay (50)
View.Update
cls
Draw.FillBox (x1, y1, x2, y2, col)
Draw.FillBox (x3, y3, x4, y4, black)

this is above all the if key
now i see the black square on startup, but then it disappears and only the original character sqaure is left showing
i also removed the delays from the ifs so there is only 1 single delay in the whole loop
bc123




PostPosted: Sun Jan 22, 2012 12:51 am   Post subject: RE:Running something in backround?

ahh, good news, ive got the delays working fine, missle is fine, collison is find to my liking at the moment, now i need to figure how how to move left and right while in air, any ideas?
Alex C.




PostPosted: Sun Jan 22, 2012 1:13 am   Post subject: RE:Running something in backround?

multiple if statements one after the other (no elsifs...)
bc123




PostPosted: Sun Jan 22, 2012 1:27 am   Post subject: RE:Running something in backround?

hmm, actually, i changed my mind and im now working on shooting, now my idea is correct, but im having trouble writing it in turing

PSEUDO : press space, shoot from character coordinates, if the bullet hits missle, missle resets to original coords.

Now, i know my problem, and still unsure how to fix it.

Problem: Everything moves in increments of 10, if im 15 pixels away from missle and i shoot, ill be adding on odd numbers, not being able to colide with the missle.

Is there a way to code if bullet is withing the range of the missle then reset?
bc123




PostPosted: Sun Jan 22, 2012 1:45 am   Post subject: RE:Running something in backround?

also, i quickly tried the right and left movement with some ifs, and it works fine, now im stuggling with this shooter thing Sad
Alex C.




PostPosted: Sun Jan 22, 2012 11:00 am   Post subject: RE:Running something in backround?

lower the increments and delays, that will speed up your program as well as make the collision more detectable
Sponsor
Sponsor
Sponsor
sponsor
mirhagk




PostPosted: Sun Jan 22, 2012 6:33 pm   Post subject: RE:Running something in backround?

Or better yet just use Math.Distance to calculate how far the bullet is from the missile and if it's within 5, then count it as a hit.

Or if you want to be really accurate you can use linear collision detection (think of the lines as the paths the bullet/missile went since the last frame) It will be 100% accurate (even if your game goes a lot slower) but it might be difficult to do.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 24 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: