tinytim
03-08-2002, 09:40 AM
lets ask how to tell the computrer that when you press the up arrow you move up
ok lets talk pacmantinytim 03-08-2002, 09:40 AM lets ask how to tell the computrer that when you press the up arrow you move up wild wolf 03-08-2002, 11:05 AM follow this link (http://www.visualbasicforum.com/showthread.php?s=&threadid=20564) Iceplug 03-08-2002, 03:19 PM Are we finished talking?:) tinytim 03-11-2002, 10:07 AM ok that helped now how do you put limitations on it like this is a wall you can't walk through it wild wolf 03-11-2002, 10:31 AM a quick search for collision detectin in the forum and i get this results click here (http://www.visualbasicforum.com/search.php?s=&action=showresults&searchid=15201&sortby=lastpost&sortorder=descending) tinytim 03-12-2002, 09:33 AM you please give example code not to offend you but to keep the information on this thread so those who look over it are not blindly wondering around all over the website Thinker 03-12-2002, 09:41 AM Hey! "blindly wondering around all over the website" is what this website is here for. There is nothing wrong with that. :D tinytim 03-12-2002, 09:42 AM this is what i have so far Private Sub Picture1_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyUp Then Picture1.Top = Picture1.Top - 80 End If If KeyCode = vbKeyEscape Then End End If If KeyCode = vbKeyDown Then Picture1.Top = Picture1.Top + 80 End If If KeyCode = vbKeyLeft Then Picture1.Left = Picture1.Left - 80 End If If KeyCode = vbKeyRight Then Picture1.Left = Picture1.Left + 80 End If End Sub tinytim 03-12-2002, 09:46 AM yes but i would like to keep information on the subject in my thread for futre reffrence and if every one starts puting serches on here but no code you will be continnually searching and not finding answers:D Squirm 03-12-2002, 10:01 AM Why take the time to repost example code when you could more easily just provide a link to existing code? Also, you might be interested to learn to use the Select Case programming structure instead of all those If blocks..... :) tinytim 03-12-2002, 10:13 AM i typed this my self ok ChiefRedBull 03-12-2002, 01:00 PM Good. Well done.... Is it working? Teric 03-12-2002, 01:43 PM In the code above, the sub is Picture1_KeyUp. I think it would probably work a lot better if you didn't put the sub on the Picture1 object, but on the form itself. Then, set the 'KeyPreview' property of the form to true so that all key events will be processed by the form. Then, make sure the event is the KeyDown event, not the KeyUp event. tinytim 03-12-2002, 08:35 PM post exaple code for the collision detection in 2d please please:( :( tinytim 03-12-2002, 08:36 PM and yes the above code is working :) tinytim 03-12-2002, 08:39 PM and searching gives me a headache when i don't have time to do it in im not lazy ok orufet 03-12-2002, 08:43 PM Answering posts than can be answered by a search gives me a headache. Searching actually takes a lot less time than posting and waiting for an answer. tinytim 03-12-2002, 08:48 PM im doing this tonight so when i have access to the compiler at school tomorow Aviator 03-12-2002, 10:06 PM Originally posted by tinytim Private Sub Picture1_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyUp Then Picture1.Top = Picture1.Top - 80 End If If KeyCode = vbKeyEscape Then End End If If KeyCode = vbKeyDown Then Picture1.Top = Picture1.Top + 80 End If If KeyCode = vbKeyLeft Then Picture1.Left = Picture1.Left - 80 End If If KeyCode = vbKeyRight Then Picture1.Left = Picture1.Left + 80 End If End Sub Like somebody above said, you should use the Select Case statements to make this coder easier to manage and a bit shorter. Here is how it looks better: Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyLeft Picture1.Left = Picture1.Left - 80 Case vbKeyUp Picture1.Top = Picture1.Top - 80 Case vbKeyRight Picture1.Left = Picture1.Left + 80 Case vbKeyDown Picture1.Top = Picture1.Top + 80 End Select End Sub tinytim 03-13-2002, 09:24 AM it wasn't hard but i just copied and pasted and made small changes tinytim 03-13-2002, 09:26 AM for the new info all I've done so far i have learned on my own tinytim 03-13-2002, 10:08 AM lets talk projectiles Pookie 03-14-2002, 01:56 AM I never knew Pacman had any projectiles (flying objects) in it???? :-\ Iceplug 03-14-2002, 07:00 AM OOH. Pac-Man War, perhaps. :-\\ What do you mean, projectiles? As in a bomb thrown across the board. Bullets? Pac-Man can jump? Are we finished talking? (I guess not) ;) Aviator 03-14-2002, 07:57 AM Projectiles? Sounds like pacman has got into a bit o' trouble and has the U.S. Army chasing him? No you say? Well, last time I played pacman (6, maybe 7 years), I don't remember any projectiles, although now that I think about it, it could be kind of cool if the enemy dudes shot little things at you that travelled slightly slower than you. Well I dunno really, so you're gonna have to tell us where you plan on implementing projectiles. ChiefRedBull 03-14-2002, 11:08 AM I dont think he needs help, just wants to chat about it. :D "lets talk projectiles" Iceplug 03-14-2002, 03:45 PM Are you saying we should talk in projectilese? OK. :) Gravity - constant. Speed = Speed - Gravity. Distance = Distance + Speed. If Distance > Ground.Distance Then Object.Stop 'notice that this is not real code, just a weird algorithm Projectile-ese. Perhaps Projectile-ish. Perhaps Projectile-ian. The language of the projectiles. :D Are we finished talking? Kitaiko 03-14-2002, 10:05 PM I think thats called psuedocode or something Pookie 03-14-2002, 10:57 PM Oh I didn't realise that TinyTim wanted to just talk about projectiles... Okay, Projectiles are things which fly in the air and are projected from one place to another, so they can be anything from an arrow, bullet, flying elephant or anything else that can be thrown, etc... and if you not careful, they can poke your eye out too. ;) Can we see the code to your game as it sounds like it's going to be a good game??? :cool: tinytim 03-19-2002, 09:40 AM sorry for leaving you guys hanging but i was not able to go on the internet for awhile but to ansewr the questions it is bullets and its not going to be normal pac man but what ever comes out of my mind Iceplug 03-19-2002, 01:55 PM Pac-Man/Doom perhaps? Pellets, ghosts, and ammunition cases... this'll be interesting. Bullets aren't really projectiles (actually, they are) in the sense that they'll be traveling in a straight line. Unless Pac-Man is going to be a strategic war game or something with falling bullets. Boom!:eek: Computer_Guy 03-19-2002, 06:04 PM I'm interesting in seeing a breed of games like that myself, lol Pookie 03-20-2002, 12:54 AM Now that everyone seems to be waiting to see how this game turns out, hope it ain't going to be a fizzer. :D j/k I don't quite get the bullets thing, won't that make the game so easy as all you need to do is wait for any ghosts to come close to you before shooting them... Or is there more to it? Iceplug 03-20-2002, 07:23 AM I'm picturing Pac-Man going down a dark hallway, collecting pellets and ammunition cases(?). All of a sudden something emerges from the darkness racing at Pac-Man. Pac-Man expends some ammunition and destroyes the enemy. The enemy drops a key that opens a door previously encountered by Pac-Man. Sounds interesting. Then a great big orange jumps across the hallway...:D Banjo 03-20-2002, 08:34 AM Sounds like a standard FPS. To whole point of PacMan was that you couldn't fight the Ghosts, you had to decide on the best path to avoid them; exception for when you picked up a pill. Now what would be an interesting variation would be to replace the pills with guns and for a time limited period you can go stomping around the level blasting the ghosts. Actually, thinking about this has triggered a memory. There was a secret level in Wolfenstein 3D that did just this. You had to find your way around a maze filled with four Ghosts (that you couldn't kill and loads of troops). The aim was to gather treasure that was spread throughout. tinytim 03-21-2002, 09:41 AM how imaginative you have alot of time on your hands i like more sample code on projectiles IN 2D OK ahem plz don't mean to sound rude ahem. Iceplug 03-21-2002, 10:32 AM Wait. Are these "projectiles" in the sense that gravity pulls them down, or are they just bullets going in a straight line? Are we viewing Pac-Man from above? tinytim 03-22-2002, 09:50 AM straight line starting with something easy so would you teach the noob like me Iceplug 03-22-2002, 10:19 AM Some sort of loop that advances the bullets. Bullet.Dist=Bullet.Dist+Bulletspeed You can set the bulletspeed on your own, along with whatever looping system you will use... Timer, DoEvents, Do...Loop, Function Call, etc... that's up to you. :cool: tinytim 04-03-2002, 09:13 AM now how do you produce the so called bullet Iceplug 04-03-2002, 09:21 AM Produce a bullet... hmm. Use a shape or some simple object unless you have a pre-drawn bullet somewhere. Make a control array of these bullets. The number of bullets is the maximum number of bullets that Pac-Man can shoot (:cool:). Let's say that Pac-Man shoots using the spacebar... In the KeyDown check for which bullet is not being used with a boolean array (you may can get away with using the bullet control visible or enabled property - I prefer visible). The first bullet that is available will be shot. I assume you have code for the bullet already somewhere. :) That's about it... I think. Squirm 04-03-2002, 12:39 PM To cycle through bullets, use something like this: Dim PlrShots(10) As BulletType 'Or whatever type its supposed to be 'Could be a control array if you want Private Sub Shoot() Static iNextFree As Integer 'Next bullet to fire With PlrShots(iNextFree) .Visible = True .X = Player.X .Y = Player.Y 'Set all the characteristics for THIS particular bullet End With iNextFree = iNextFree + 1 'Increment bullet counter 'Clock over the bullet counter at 10 If iNextFree > 10 Then iNextFree = 0 End Sub tinytim 04-04-2002, 09:31 AM ok here is my project can any one do anything with it Iceplug 04-04-2002, 10:08 AM ok here is my project can any one do anything with it I can... I couldn't figure what the line keyup procedure was for... so I commented it. The keyup procedures are effective on the form... after disabling the picturebox. :) Pookie 04-04-2002, 10:26 PM Hmmm... Am I missing something here?????? :confused: I thought this was suppose to be a pacman game? All I could see in that zip file was a tiny routine for testing keyup? You haven't even put in a keydown routine which would make the keyup routine of any value.... Guess that zip wasn't the whole program??? tinytim 04-05-2002, 09:09 AM well its suposed to be but i think i might go side scrolling tinytim 04-05-2002, 09:15 AM oh i forgot to dw\elete that didn't i sry for confusing you tinytim 04-05-2002, 09:19 AM by the way thx tinytim 04-05-2002, 09:29 AM so now he stops but i cant move bellow the line why not Iceplug 04-05-2002, 05:14 PM Because you only checked if the obja was left of the line... nothing about the top down stuff. This requires more coding. This line seems to fit somewhere: If Obja.Top >= Objb.Y1 - Obja.Height And Obja.Top <= Objb.Y2 Then tinytim 04-08-2002, 09:12 AM yes it does what could go to the then and make it work tinytim 04-08-2002, 09:14 AM oh and if some one could produce a projectile on the most recent zip file that would be nice leave sub notes on what library was used Iceplug 04-09-2002, 07:00 AM If Obja.Top <= Objb.Y1 - Obja.Height And Obja.Top >= Objb.Y2 And Obja.Left <= Objb.X1 I actually meant this. This would go in the KeyLeft section to stop the obja from moving - in the same spot where there was Obja.Left <= Objb.X1. In the KeyRight, this would be Obja.Left >= Objb.X1. Or something similar. I'm not sure, though. :) |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum