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

Username:   Password: 
 RegisterRegister   
 [tutorial] movement (getch,keydown,mouse)
Index -> Programming, Turing -> Turing Tutorials
Goto page Previous  1, 2, 3  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Paul




PostPosted: Sun Feb 01, 2004 4:58 pm   Post subject: (No subject)

dodge, you should do a tutorial on whatdotcolor collision detection. It sounds like you've mastered it.
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Sun Feb 01, 2004 5:02 pm   Post subject: (No subject)

hmmm good idea... i'll do it one of these days when i'm not so busy wit everytin... but i can tell u the basic idea of it... basicly you have a picture or an array of pictures since there is View.UpdateArea of each object and its surroundings... and instead of having them multicolored, you have each object as one color, then you just use whatdotcolor to see if something touched... but each time something moves, you'll have to re update the pictures
jonos




PostPosted: Sun Feb 01, 2004 5:17 pm   Post subject: (No subject)

i think i just did the whatdotcolor collisions detection in the help forum under collision detection, i fixed it htough something is still wrong...
TheXploder




PostPosted: Sun Feb 01, 2004 5:54 pm   Post subject: (No subject)

Arrays could work much better if you use coulored tiles...

for every 1 in the array collide...

but whatdotcolour is easier to use when your making a helicopter fly through the cave type of game, or worms, where your terrain could be all over the place... right Dodge?
Cervantes




PostPosted: Sun Feb 01, 2004 6:01 pm   Post subject: (No subject)

whatdotcolour would be the easiest way for the helicopter game... It would be VERY hard to do it without whatdotcolour, you'd have to use arrays to hold the position of the blocks that are in your path.

whatdotcolour is also useful in cool programs where you have funky colours all over the place and something bouncing around those infront of those colours and changing whenever it hits a colour Smile basically any funky program Very Happy
Andy




PostPosted: Sun Feb 01, 2004 6:29 pm   Post subject: (No subject)

thats more like it, +10 bits
Paul




PostPosted: Sun Feb 01, 2004 6:32 pm   Post subject: (No subject)

Actually whatdotcolor is the only way I understand how to use, in a program like the one I proposed with manuvering thru a tube with different width. Whatdotcolor is the greatest. Embarassed
Andy




PostPosted: Sun Feb 01, 2004 6:35 pm   Post subject: (No subject)

man, if everybody learned whatdotcolor before all things, the world will be a much better place +5 bits
Sponsor
Sponsor
Sponsor
sponsor
DanShadow




PostPosted: Fri Feb 06, 2004 2:20 pm   Post subject: (No subject)

Wow...this got kinda popular. Im gonna go write a very simple tutorial of collision detection using whatdotcolor.Hail Whatdotcolor
djlenny_3000




PostPosted: Tue Mar 23, 2004 5:43 pm   Post subject: (No subject)

question: in key down is it possible to use 2 buttons so for example the ball could go on an angle

and also what are the inputs in keydown for letters such as "w" or "s"

thnx
jonos




PostPosted: Tue Mar 23, 2004 8:51 pm   Post subject: (No subject)

ok to your first question: yes. just make all the separate key presses in a separate if statement. don't use elsif's, just make new if statements.

as to your second question: yes. i believe that it is 'character' (so the key you want pressed in single quotes). im not sure on that one, someone may correct it if it is wrong.
Cervantes




PostPosted: Tue Mar 23, 2004 9:48 pm   Post subject: (No subject)

correct.
but don't forget to put it in brackets.
code:

if chars ('w') then
djlenny_3000




PostPosted: Tue Mar 23, 2004 10:01 pm   Post subject: (No subject)

right thnx now i can finally finish my pac man game for my compsci teacher
BTW
which is probably better using 2 arrows to make a diagonal movement
or designate letters as the controls and use the coresponding ones as diagonals
jonos




PostPosted: Tue Mar 23, 2004 10:17 pm   Post subject: (No subject)

you could use the numpad, but i think that using 2 keys would be best. its the easiest to remember and many people use the combonations of keys in other games.
DanShadow




PostPosted: Fri Jul 30, 2004 9:04 pm   Post subject: (No subject)

here is the answer to the moving on an angle question:
code:

if key(KEY_UP_ARROW) and key(KEY_RIGHT_ARROW) then
x+=1
y+=1
elsif ....%%

end if

etc. etc. very easy stuff
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 3  [ 44 Posts ]
Goto page Previous  1, 2, 3  Next
Jump to:   


Style:  
Search: