Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Need simple code

Author
Message
Filmmaker Screenwriter
21
Years of Service
User Offline
Joined: 7th Jul 2003
Location:
Posted: 9th Jul 2004 06:11 Edited at: 9th Jul 2004 06:15
Hey. Thanks for reading. I am just starting out. Me and several others are working to create a Pac Man clone. Basically it will be just like the regular Pac Man we all know and love and all the objects will be made with 3D primitives.

I have just a few questions.

1.) I need some code: I need a code that says IF the user presses the up arrowkey, THEN they will move upwards at a decent speed. Basically I need the code for all 4 arrow keys.

2.) Does anyone know where I can find array collision tutorials or snippets of some sort?

Wow, I can't tell you enough how much I appreciate your support. Thank you in advance for your help.

EDIT: oh sorry, if this helps, it will be controlling a yellow sphere's movement, i dont know how large it will be yet, but think along the lines of Mr. Pac Man, respectively, lol.

Pentium4 3GHZ, 512MB DualChannel RAM, 256MB ATI Radeon 9800XT, SoundBlaster Audigy2, 120 GB HD.
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 9th Jul 2004 06:19
On moving around....

In my Nibbles clone I did it the easy way;

if upkey()=1
wayx = 0
wayy = -1
endif
if leftkey()=1
wayx = -1
wayy = 0
endif

And so on. The values of wayx and wayy were added to the character's position on each pass through the main loop, so the image moved in the direction of the arrows. For 3D, you'd do much the same thing though use values for X and Z axis, and adjust the 1/0 to whatever the current move speed is in your game.

I'll let others handle the collision stuff, I'm still learning there too.
S.

Any truly great code should be indisguishable from magic.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 9th Jul 2004 06:26 Edited at: 9th Jul 2004 06:28
You will probably want to look at the sticky posts above. Thought they may not exactly be 3d pacman they will be very helpfull in starting out.

Hope this helps You will need to assign the variable objectnumber to the object number of the sphere you create and the variable distance to how far you want it to move. I am not at home so I can't test this code. It may need some tweaking but it gives you somewhere to start.

[edit] SandraD's way will also work. I was beaten to it Really down to the way you want to do it.

SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 9th Jul 2004 06:35
Hahahaha... Surprise Lost in Thought!
S.

Any truly great code should be indisguishable from magic.
Filmmaker Screenwriter
21
Years of Service
User Offline
Joined: 7th Jul 2003
Location:
Posted: 9th Jul 2004 13:41
well, thanks guys. ill present these to "the boss man" (lol) and we'll see what happens. im also beginning the binarymoon tut so i think ill eventually have a good idea of both those things and how they work, too.

Thanks Again!!

Pentium4 3GHZ, 512MB DualChannel RAM, 256MB ATI Radeon 9800XT, SoundBlaster Audigy2, 120 GB HD.

Currently developing: 3D Pac Man Clone (working title)

Login to post a reply

Server time is: 2024-11-27 00:36:22
Your offset time is: 2024-11-27 00:36:22