Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Just wondering if i doing this right
Old
SirThorfinn
Senior Member
 
SirThorfinn's Avatar
 
Status: Offline
Posts: 232
Join Date: Sep 2010
Location: Some where Unreal!
Default Just wondering if i doing this right - 10-16-2010, 05:46 PM

For my FPS i want to have weapon switching and i was just experimenting in a separate world. Would you please tell if these methods for it are good if so i'm going to use it in my game.
Wepon switching.a2w


/|..__________________/\_
/ `---___________----_____|]-------<BLAM>------>
/_==o;;;;;;;;_______.:/
), ---.(_(__) /
// (..) ), ----"
//___//
//___//

<Youtube Page> (Not much there but maybe something you'll like) http://www.youtube.com/user/SirThorfinn?feature=mhum
<Xbox Live Gamertag> SirThorfinn

-----Friend of Thor-------------------------------------------
-----Spartans NEVER Die------------------------------------
All most anything on SirThorfinn is me... Almost.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 10-16-2010, 07:11 PM

A lot of your methods are unnecessary, for example you have different "take out" and "put away" methods for each gun. You could have world method for "take out" and "put away" and even firing by using parameters, and by using the parameters for if/else statements within the methods to choose which gun to take out, all in 1 method.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
SirThorfinn
Senior Member
 
SirThorfinn's Avatar
 
Status: Offline
Posts: 232
Join Date: Sep 2010
Location: Some where Unreal!
Default 10-16-2010, 07:27 PM

The only reason the weapons had different take out and put away methods was because i wanted them to come up to the screen in different ways depending on the gun, plus the Glock had a weird center point so i had to make one for it anyway.


/|..__________________/\_
/ `---___________----_____|]-------<BLAM>------>
/_==o;;;;;;;;_______.:/
), ---.(_(__) /
// (..) ), ----"
//___//
//___//

<Youtube Page> (Not much there but maybe something you'll like) http://www.youtube.com/user/SirThorfinn?feature=mhum
<Xbox Live Gamertag> SirThorfinn

-----Friend of Thor-------------------------------------------
-----Spartans NEVER Die------------------------------------
All most anything on SirThorfinn is me... Almost.
   
Reply With Quote
Old
debussybunny563
Senior Member
 
debussybunny563's Avatar
 
Status: Offline
Posts: 852
Join Date: May 2010
Arrow 10-16-2010, 07:49 PM

It's nice, but there's a bug with the M1014 and Glock that you can have both out at once. I think it has to do with shooting and switching weapons at the same time; having variables governing those will eliminate that (e.g. If <shooting> == <false>, weapon.switch; Else, Do Nothing;;If <switching> == <false>, weapon.shoot; Else, Do Nothing)

Anyway, D-dog's right; in my FPS I used one method with If/Elses to determine which weapon should be drawn. In the long run, it is extremely useful to be able to compact coding and save up on space.


Last edited by debussybunny563; 12-21-2012 at 12:00 AM.

|--------------------------------------------------------------------------------------------------|
|Link to weapons collection: http://www.alice.org/community/showthread.php?t=7368 |
|--------------------------------------------------------------------------------------------------|

I have been dead for quite some time now; not much hope for resurrection.
   
Reply With Quote
Old
SirThorfinn
Senior Member
 
SirThorfinn's Avatar
 
Status: Offline
Posts: 232
Join Date: Sep 2010
Location: Some where Unreal!
Default 10-16-2010, 08:50 PM

Quote:
Originally Posted by debussybunny563 View Post
It's nice, but there's a bug with the M1014 and Glock that you can have both out at once. I think it has to do with shooting and switching weapons at the same time; having variables governing those will eliminate that (e.g. If <shooting> == <false>, weapon.switch; Else, Do Nothing;;If <switching> == <false>, weapon.shoot; Else, Do Nothing)

Anyway, D-dog's right; in my FPS I used one method with If/Elses to determine which weapon should be drawn. In the long run, it is extremely useful to be able to compact coding and save up on space.
Ok cool, its only an experiment so i was sure there would be issues. And ill shorten the code as much as i can with your guys' idea but the Glock has a weird center point so it wouldn't work in a method like that, the other 2 would though.


/|..__________________/\_
/ `---___________----_____|]-------<BLAM>------>
/_==o;;;;;;;;_______.:/
), ---.(_(__) /
// (..) ), ----"
//___//
//___//

<Youtube Page> (Not much there but maybe something you'll like) http://www.youtube.com/user/SirThorfinn?feature=mhum
<Xbox Live Gamertag> SirThorfinn

-----Friend of Thor-------------------------------------------
-----Spartans NEVER Die------------------------------------
All most anything on SirThorfinn is me... Almost.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 10-16-2010, 09:00 PM

You can do the individual animations within the one method. You can put the exact animation to put the glock away in the same method that you put the AK47 away, you just put it in a different if/else statement away from the AK47's animation.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
debussybunny563
Senior Member
 
debussybunny563's Avatar
 
Status: Offline
Posts: 852
Join Date: May 2010
Arrow 10-16-2010, 09:00 PM

Are you sure?
Because with If/Elses you can put different method for each weapon, so I wouldn't think having a different animation for the Glock would be a problem.


Last edited by debussybunny563; 12-21-2012 at 12:00 AM.

|--------------------------------------------------------------------------------------------------|
|Link to weapons collection: http://www.alice.org/community/showthread.php?t=7368 |
|--------------------------------------------------------------------------------------------------|

I have been dead for quite some time now; not much hope for resurrection.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 10-16-2010, 09:02 PM

Quote:
Originally Posted by debussybunny563 View Post
Are you sure?
Because with If/Elses you can put different method for each weapon, so I wouldn't think having a different animation for the Glock would be a problem.
Wow, your post was posted at literally the exact same time as I posted my previous comment. It was so fast that when I posted mine and it refreshed this post screen, it showed my comment and then yours right underneath mine, meaning that you posted in between the time of me clicking the post button and the screen refreshing again.

Never seen that happen before


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
SirThorfinn
Senior Member
 
SirThorfinn's Avatar
 
Status: Offline
Posts: 232
Join Date: Sep 2010
Location: Some where Unreal!
Default 10-16-2010, 09:03 PM

oh thats what you mean, i thought you men't to have all the weapons move to the same position when you take them out and put them back, my bad i know what you mean.


/|..__________________/\_
/ `---___________----_____|]-------<BLAM>------>
/_==o;;;;;;;;_______.:/
), ---.(_(__) /
// (..) ), ----"
//___//
//___//

<Youtube Page> (Not much there but maybe something you'll like) http://www.youtube.com/user/SirThorfinn?feature=mhum
<Xbox Live Gamertag> SirThorfinn

-----Friend of Thor-------------------------------------------
-----Spartans NEVER Die------------------------------------
All most anything on SirThorfinn is me... Almost.
   
Reply With Quote
Old
debussybunny563
Senior Member
 
debussybunny563's Avatar
 
Status: Offline
Posts: 852
Join Date: May 2010
Thumbs up 10-16-2010, 09:04 PM

Quote:
Originally Posted by Dameria View Post
Wow, your post was posted at literally the exact same time as I posted my previous comment. It was so fast that when I posted mine and it refreshed this post screen, it showed my comment and then yours right underneath mine, meaning that you posted in between the time of me clicking the post button and the screen refreshing again.

Never seen that happen before
FTW.



BTW, you're close to your 777th post.
EDIT: And this is my 515th.


Last edited by debussybunny563; 12-21-2012 at 12:00 AM.

|--------------------------------------------------------------------------------------------------|
|Link to weapons collection: http://www.alice.org/community/showthread.php?t=7368 |
|--------------------------------------------------------------------------------------------------|

I have been dead for quite some time now; not much hope for resurrection.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.