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.

DarkBASIC Professional Discussion / Shootin' a Laser Gun?

Author
Message
Yodaman Jer
User Banned
Posted: 3rd Jan 2011 19:55 Edited at: 3rd Jan 2011 19:57
Hey everyone,

this is something I've never tackled before, and I don't have any idea how to start.

I'm going to begin work on a test level for my game entry for NaGaCreMo, and one of the ideas I'm working with is shooting a laser gun that the player can use to slay enemies and maybe trigger distant switches.

I just don't really know how I would shoot a gun from 2D mouse coordinates and translate it to 3D, and how to make sure the bullets emerge from the gun and not, say, the player's head...

Also: Unrelated, but while I'm here...how would I create an inventory list that the player can use to access items and use them? I know arrays are the obvious way to go, it's just accessing them and using them to show inventory that's a little tricky to figure out.

I should mention I've got no programming done for any of this yet...I only finalized the game idea(s) yesterday and thought I'd ask people who are more experienced than me how to make a gun shoot and create an accessible inventory list.

Thanks to any and all who have advice!

-CoffeeCoder

Edited due to typos.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 3rd Jan 2011 20:18
Well before we get into lasers, let's look at the other stuff first:

Quote: "I just don't really know how I would shoot a gun from 2D mouse coordinates and translate it to 3D, and how to make sure the bullets emerge from the gun and not, say, the player's head..."


Now, I'm confused on this one, cause I'm not sure what your asking. Is it you are shooting from the mouse cursor or from a gun like an FPS? (After you've got the basis down for shooting a gun, then we can move on to the laser part)

Quote: "Also: Unrelated, but while I'm here...how would I create an inventory list that the player can use to access items and use them? I know arrays are the obvious way to go, it's just accessing them and using them to show inventory that's a little tricky to figure out."


Depending on the type of inventory then you will have fun doing this. But firstly do you have an idea of the type of inventory you want cause there's so many way we can't go through every one.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Yodaman Jer
User Banned
Posted: 3rd Jan 2011 20:24
It would be from the mouse cursor, but the bullets would have to emerge from the gun that the player is holding.


For the type of inventory I was thinking, it would just be a basic one. All it will need to do is hold a few items that can be used to unlock secret areas in levels the player has already played through.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 3rd Jan 2011 20:43 Edited at: 3rd Jan 2011 20:44
Since I'm doing GUI stuff at the mo I'll help with the GUI, plus an inventory is harder to make than the other depend on how advanced you want it.. But what I was asking before was what style, for instance:

Like drag and drop boxes in WoW:


Or a list like in Oblivion:


A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Yodaman Jer
User Banned
Posted: 3rd Jan 2011 23:06
I was thinking more like a WoW-based inventory, but it doesn't need to be drag-and-drop. The player will just have to click an image of the item they want/need to use in the game, and then click an "OK" button or something like that. Unless drag-and-drop isn't too hard to implement, I'll do it that way.

I really want to work on the laser gun before I work on the inventory though.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Jan 2011 23:26
As to lazers, check out phaelax's (I hope I wrote that correctly ) webpage, it has a lot of examples and code snippets : http://dbcodecorner.com/?page=eq (bookmark it )

This is probably what you are looking for : lazer.zip (from that website)

TheComet

Yodaman Jer
User Banned
Posted: 3rd Jan 2011 23:58
Thanks Comet! A quick look-through of that makes it look pretty easy.

Login to post a reply

Server time is: 2026-07-18 02:08:51
Your offset time is: 2026-07-18 02:08:51