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 / Help 2d Paintball!

Author
Message
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 17th Aug 2005 01:33
I am working on a 2d paintball game side scroller. and i was confused because i cant get the ball to come out of the gun no mattter if hes in air or on ground. Help please.


"Computers Are Not Smart. They Just Do What You Tell Them To."
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 17th Aug 2005 03:45
Anyone? Cmon


"Computers Are Not Smart. They Just Do What You Tell Them To."
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Aug 2005 04:07
You haven't asked a question yet... or posted any faulty code... or said exactly what your problem is.

What are we supposed to say?

TDK_Man

Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 17th Aug 2005 04:12
ok like i just started this game and. i want the bullet to like come out of the gun even if hes in the air. all the bullet does is come out in a default x,y,z coordinate how i make it follow him?


"Computers Are Not Smart. They Just Do What You Tell Them To."
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 17th Aug 2005 04:30
Cameron,

The bullet needs a few variables, preferably an array. Each variable, or array dimension will hold a specific value. These values are:

life - how long the bullet last after shot
xpos# - bullet's x coordinate position
ypos# - bullet's y coordinate position
angle# - bullet's angle of direction
speed - speed the bullet travels

Note, that initially by program default, the value in life will equal to 0, as well as the others.

Now, to initiate the bullet's movement, we need to change the value in a variable to signal a group of code to be looped through, after the user presses the "fire" button. In this case, it will be the left mouse button(LMB). Our signal will be the value in life. If it is above 0, then the bullet should move.

When the user first clicks the mouse button, we need to set all of the variables presented above. Life should be set to something above 0. xpos# and ypos# should be set to either the tip of the gun barrel, or the current x and y position of the user character. angle# should be set to either the angle the gun is currently pointed, or the angle the user character is currently facing. speed should be set to, of course, the speed you wish the bullet to fly.

Therefore:


The code above will "turn the bullet on" and set its properties. When I say "turn the bullet on", I mean that the code which makes the bullet to move across the screen, is only ran if so-be that the value in life is greater than 0. The code above sets this value to 30. Now, we must make the bullet move.

Example:


Once the value in life = 0 again, the bullet will dissapear. Remember, when the user presses the "fire" button, set properties of the bullet according to the properties of the shooter character. These needed properties are listed above. Also, use the value in life to make to bullet move, or not move. This keeps yoiu from having to use another variable to do so(killing two birds with one stone).

One last note, don't beg for help here.


+NanoBrain+
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 17th Aug 2005 04:57
k thanks.


"Computers Are Not Smart. They Just Do What You Tell Them To."
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 17th Aug 2005 08:40
Cameron,

Does your response mean you understand, and can implement the method into your code without further assistance?


+NanoBrain+
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 17th Aug 2005 16:31
well sort of
i got it all setup im trying to figure out how i make it come out
i tryied
if mouseclick() = 1 then paste image 1,600
but im sort of confused


"Computers Are Not Smart. They Just Do What You Tell Them To."
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Aug 2005 16:53
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 17th Aug 2005 21:27
Cameron,

Paste the image on the coordinates that are located in the code below. Also, place this paste image command within this group of code, in this if statement. This way, only the image will paste when the bullet is in movement, and it will be paste on the changing coordinates each loop.

Example:



+NanoBrain+
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 18th Aug 2005 01:51
k


"Computers Are Not Smart. They Just Do What You Tell Them To."
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 18th Aug 2005 01:56
ok heres part of the code still doesent work




"Computers Are Not Smart. They Just Do What You Tell Them To."
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 18th Aug 2005 21:16
Cameron,

Why are you resetting your character's position to 1 and 300 every loop? Might I see your full code, that I may better understand how your character movement is set up? There might not be a need for angle#, but some other method.


+NanoBrain+

Login to post a reply

Server time is: 2024-11-27 20:37:00
Your offset time is: 2024-11-27 20:37:00