Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
making game with guns!!!; putting and using guns into game
Topic Started: Nov 22 2010, 12:53 AM (321 Views)
joihnsonlee
Advanced Member
[ *  *  * ]
how do i put a 2d gun in the screen (like doom 2 when u are using a gun) with target.

also how do i make my gun shoot (slow travelling) bullets (quake 2's starting weapon)

ps please tell which code goes with which object and which event.

or tell me where i can find an example which can do all of it.
Offline Profile Quote Post Goto Top
 
RonBurgundy
Member Avatar
Forum Borat
[ *  *  *  *  *  * ]
for a 2d gun use DrawTex in Draw for control object

to make bullets do something like

char object step:

if MouseCheckButton(mb_left) = 1
{

if ! instance_exists(bullet)
instance_create(x,y,bullet)
}

bullet step:

rotx=camera.rotx
roty=camera.roty
Move(camera.rotx,camera.roty,10)
Edited by RonBurgundy, Nov 22 2010, 02:53 AM.
!!! DEFEND POP PUNK !!!
Offline Profile Quote Post Goto Top
 
joihnsonlee
Advanced Member
[ *  *  * ]
sorry can u tell in more detail where DrawTex is?

and is all the code u shown are in the charater object?

or is bullet step in another object?
Offline Profile Quote Post Goto Top
 
RonBurgundy
Member Avatar
Forum Borat
[ *  *  *  *  *  * ]
joihnsonlee
Nov 22 2010, 03:10 AM
sorry can u tell in more detail where DrawTex is?

and is all the code u shown are in the charater object?

or is bullet step in another object?
DrawTex goes in the control's draw event but you'll need to set up a texture to use first using LoadTexture have a look at the documentation for more info for those two.

only the 1st part of that code goes in the char object step event the second part goes in the bullet step event.
!!! DEFEND POP PUNK !!!
Offline Profile Quote Post Goto Top
 
joihnsonlee
Advanced Member
[ *  *  * ]
i feel a bit lazy.

i must i make a texture?

looks difficult.

can't i use a sprite instead (the game maker tutorial way).

if i must use textures which pages must i read?

or if u feel friendly can u tell in short how to do it (texture or game maker tutorial method)?
Offline Profile Quote Post Goto Top
 
RonBurgundy
Member Avatar
Forum Borat
[ *  *  *  *  *  * ]
joihnsonlee
Nov 22 2010, 04:07 AM
i feel a bit lazy.

i must i make a texture?

looks difficult.

can't i use a sprite instead (the game maker tutorial way).

if i must use textures which pages must i read?

or if u feel friendly can u tell in short how to do it (texture or game maker tutorial method)?
lol tell you what I'll make an exampe for you possibly tomorrow kay?
!!! DEFEND POP PUNK !!!
Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
joihnsonlee
Nov 22 2010, 04:07 AM
i feel a bit lazy.

i must i make a texture?

looks difficult.

can't i use a sprite instead (the game maker tutorial way).

if i must use textures which pages must i read?

or if u feel friendly can u tell in short how to do it (texture or game maker tutorial method)?
Geez.

Edited by Despellanion, Nov 22 2010, 04:47 PM.
Offline Profile Quote Post Goto Top
 
joihnsonlee
Advanced Member
[ *  *  * ]
thanks

(if u are not pulling my leg and actually do it.)

and again many thanks!!!!
Offline Profile Quote Post Goto Top
 
RonBurgundy
Member Avatar
Forum Borat
[ *  *  *  *  *  * ]
joihnsonlee
Nov 22 2010, 05:03 PM
thanks

(if u are not pulling my leg and actually do it.)

and again many thanks!!!!
wow, i'll do it okay dayummmmmmm.

look for it later tonite, luckily you caught me in a good mood. <_<
!!! DEFEND POP PUNK !!!
Offline Profile Quote Post Goto Top
 
RonBurgundy
Member Avatar
Forum Borat
[ *  *  *  *  *  * ]
Okay Here ya go! ^_^
Attached to this post:
Attachments: bulletexample.zip (881.96 KB)
!!! DEFEND POP PUNK !!!
Offline Profile Quote Post Goto Top
 
joihnsonlee
Advanced Member
[ *  *  * ]
thank u!!!!
Offline Profile Quote Post Goto Top
 
joihnsonlee
Advanced Member
[ *  *  * ]
how do i switch weapons because at the moment i can only use one.

because i don't know how to put an event (draw) inside another event (press 1 or 2 "press keyboard button")

(if that makes sense)

and yes i have a texture.

if only there was way that i can press "1" which will equip (draw) one weapon and press "2" to switch with (draw) another weapon.


Edited by joihnsonlee, Nov 23 2010, 01:44 AM.
Offline Profile Quote Post Goto Top
 
Monty
Member Avatar
Forum Leader
[ *  *  *  *  * ]
joihnsonlee
Nov 23 2010, 01:11 AM
how do i switch weapons because at the moment i can only use one.

because i don't know how to put an event (draw) inside another event (press 1 or 2 "press keyboard button")

(if that makes sense)

and yes i have a texture.

if only there was way that i can press "1" which will equip (draw) one weapon and press "2" to switch (draw) another.


This isn't really U3D related at all. Make a variable for the current gun (current_gun) that holds a number, which can be switched using the keyboard press events. In the draw event, you do:
Code:
 
{
if(current_gun==0)
{
// Your DrawTex code for the first gun
}
if(current_gun==1)
{
// Your DrawTex code for the second gun
}
}


or if you're feeling fancy:
Code:
 
{
switch current_gun
case 0:
{
// Your DrawTex code for the first gun
}
case 1:
{
// Your DrawTex code for the second gun
}
}


They're the same exact thing btw.

But this is all basic GML. If you don't feel comfortable with GML you can always use the action library of U3D to make things easier (but much more limited).
Edited by Monty, Nov 23 2010, 01:53 AM.
Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
joihnsonlee
Nov 23 2010, 01:11 AM
how do i switch weapons because at the moment i can only use one.

because i don't know how to put an event (draw) inside another event (press 1 or 2 "press keyboard button")

(if that makes sense)

and yes i have a texture.

if only there was way that i can press "1" which will equip (draw) one weapon and press "2" to switch with (draw) another weapon.


Might I suggest to learn basic programming before attempting to do advanced 3d games? You won't get anywhere doing it like this, having other people program the game for you.
Edited by Despellanion, Nov 23 2010, 08:30 AM.
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply