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 / bullet making problem-dbpro plz help...

Author
Message
Rockstar AP
12
Years of Service
User Offline
Joined: 19th Jan 2012
Location:
Posted: 24th Jan 2012 13:59
hello.....
i just cant seem to produce a fast bullet out of my character(box)...
plz help!!!!!!

here is my code


Rem Project: prac1
Rem Created: 1/23/2012 7:56:57 PM

Rem ***** Main Source File *****
sync on
set window off
hide mouse
autocam off

`set some starting variables
facing# = 0 :`direction camera is looking left and right
pitch# = 0 :`direction camera is looking up and down
camera_distance# = 50 :`how far camera is away from player
camera_height# = 10 :`distance above player camera is pointing at

movement_speed# = 0.5 :`how fast the player moves
turn_multiplier# = 0.1 :`a factor that controls how fast the player turns left and right
pitch_multiplier# = 0.1 :`a factor that controls how fast the player looks up and down
jump_speed# = 0.5 :`initial jump speed


gravity# = 0.003 :`gravity


`make something for the ground and a cube to represent the player
make matrix 1, 1000,1000,10,10



make object cube 1, 10
position object 1, 500,5,500
`main loops
do

`arrow keys to move the player
if upkey() = 1 then move object 1, movement_speed#
if downkey() = 1 then move object 1, movement_speed#*-1
if leftkey() = 1 then move object left 1, movement_speed#
if rightkey() = 1 then move object right 1, movement_speed#

`jump controls
if jump = 0
if controlkey() = 1
`set the velocity in the y direction to the initial jump speed
y_vel# = jump_speed#
jump = 1
endif
endif

`calculate vertical velocity and move object in the y axis
y_vel# = y_vel# - gravity#
move object up 1, y_vel#

`check to see if the object has hit the ground
if object position y(1) < 5
`stop the object from falling
position object 1, object position x(1), 5, object position z(1)
`set velocity in the y direction to zero
y_vel# = 0
jump = 0
endif

`mouse to look left, right and up, down
move_mouse_x# = mousemovex() :`write mouse move to variable
move_mouse_y# = mousemovey() :`write mouse move to variable

`calculate the direction the player and camera is facing
facing# = wrapvalue(facing# + move_mouse_x#*turn_multiplier#) :`left and right
pitch# = wrapvalue(pitch# + move_mouse_y#*pitch_multiplier#) :`up and down

`restrict up and down movement camera pitch
campitchtest# = wrapvalue(pitch#+180)
if campitchtest# < 90 then pitch# = 270
if campitchtest# > 270 then pitch# = 90


`rotate the cube (player) to the new facing left and right
yrotate object 1, facing#


`this is the first method for camera control
set camera to follow object position x(1), object position y(1), object position z(1), facing#, camera_distance#, camera_height#, 10,0
`this line lets the player look up down
xrotate camera pitch#


set cursor 0,0
print "use arrow keys to move, mouse to look and control to jump"

print
center text screen width()/2,screen height()/2,"+"

sync

loop

A.P
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 24th Jan 2012 17:26
I might be missing it, but I don't see the creation of any object which could be a bullet. You'll need to set a control to fire a projectile and a function to describe that projectile's motion.

this might help:
http://forum.thegamecreators.com/?m=forum_view&t=11974&b=7

but you also might want to look at some books or tutorials...
also please use the forum's

brackets to post code so that it is easier to read.
And please use indents

Rockstar AP
12
Years of Service
User Offline
Joined: 19th Jan 2012
Location:
Posted: 24th Jan 2012 17:39
sorry but didn't help....
i just dont know how to set up a bullet.....

A.P
Rockstar AP
12
Years of Service
User Offline
Joined: 19th Jan 2012
Location:
Posted: 25th Jan 2012 06:44
anyone!!!!!

A.P
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 25th Jan 2012 21:23
Quote: "i just dont know how to set up a bullet....."

There are many ways to 'set up' bullets and so you need to find a way which works for you and to do this it's best you work it out yourself.

What I suggest you do is create another DBP project purely for experimenting with bullets, it may be best to start in 2D. Look at the very basics of how a bullet works. It has a starting point and speed. You'll need to work out the conditions for resetting the bullet and when to stop it. Then you can learn how to apply angles to the bullet and translate it into 3D, and work out a system for handling multiple bullets.

It may also be worth reading this

nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 28th Jan 2012 17:15
uh.... OP.... Some suggestions (without trying to be offensive)

1. Don't "self-bump" i.e. double post. Sometimes it may take a while for your post to be replied to. If it is not, then nobody who feels like it is online. Don't stress, give it time. Bumping your own threads may get you in trouble with the MODs.

2. You should use code tags instead of just posting a gazillion lines of code. It actually puts people off helping sometimes. This is a code tag:

This is how to do it:


Login to post a reply

Server time is: 2024-11-23 23:28:25
Your offset time is: 2024-11-23 23:28:25