Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Fps help (http://www.alice.org/community/showthread.php?t=4467)

Techique 05-20-2010 03:58 PM

Fps help
 
So i have my Fps all setup...
Problem is i can look up and walk forward into the sky, or down into the ground... anyway to fix this?

cbw92 05-20-2010 05:57 PM

It sounds like you're turning the whole characcter forward and backward when you try to aim up and down. Try making two objects, or one object, and control the camera. So the first object will move on a 2d plane (the ground) and the camera is then set vehicle to your first object. Now, seperately turn the camera up and down, and it will function independantly of the character.

Dameria 05-20-2010 06:34 PM

[QUOTE=Techique;21559]So i have my Fps all setup...
Problem is i can look up and walk forward into the sky, or down into the ground... anyway to fix this?[/QUOTE]

I have made a few worlds in which I have a fix to this. What I did was I created a simple cube called "body", and I made it so that any movement forward, backward, left and right is done by "body", but looking up and down is done by the camera, and the camera is vehicle to the body. Try to find my "looktest" world (if you can't find it I can post you a link to it), but I have a method where I use the mouse to look left right up down, but the left and right move the body and up down move the camera, so the body always stays parallel to the ground and does not move up when I am looking up and moving forward at the same time.

Does this make sense?

Techique 05-20-2010 06:48 PM

Yes, thank you ill keep this in mind but, somehow it fixed itself... must of been something i did. another question though, I have Health setup for my player, now im doing health for zombies.... but how do you setup separate health bars for each zombie? i have a variable that holds each zombie.

Dameria 05-20-2010 07:05 PM

[QUOTE=Techique;21562]Yes, thank you ill keep this in mind but, somehow it fixed itself... must of been something i did. another question though, I have Health setup for my player, now im doing health for zombies.... but how do you setup separate health bars for each zombie? i have a variable that holds each zombie.[/QUOTE]

This would be a lot easier if the world function "(object's) variable named ____" worked properly, because then you could just have health variables for every zombie and use a list for all of them with that function being used to check each one. The only way I can think of doing this though would be to have a very large if else statement with a nested if/else for every zombie that is being checked. For instance the zombie is hit, it runs the health method, and you put in the zombie that is hit as the parameter for the method, and in the method you say if(zombie == zombie1) ((with zombie as the parameter)), then you do whatever method you have for lowering it's health, else if zombie == zombie 2, and then the next health method for zombie 2 using his own unique health variables.

Techique 05-20-2010 07:13 PM

Seems Tedious..... I think i Might make them One shot zombies.. and have maybe a few bosses and setup the health like i did with my player Health.

Dameria 05-20-2010 07:17 PM

Yeah, that is what most people do. I can't wait until they fix that function though so that I can use it. Try dropping that function into an if else statement though and tell me if it works, it might just be my version that does not work.

Techique 05-20-2010 07:21 PM

Hold on I'll check it out

__________________________

Didn't work

Techique 05-20-2010 07:26 PM

Hm.... Quite Confused now....

Bullet 2 meters near "item_from_Zombies"
"item_from_zombie" Turn Back .25 revo's

but instead they all 3 i have setup right now turn backwards one after another think you can check it out?

Dameria 05-20-2010 07:31 PM

Its because it checks to see if the bullet is within all 3 of the zombies, and when it is within one of the zombies, you say to all 3 zombies backwards. If you want it to only turn the 1 zombie backwards that the bullet collides with, create a seperate method called "die" and add an object parameter for "zombie", then in that code when it checks to see if the bullet is within each of the zombies, you just run the method world.die with the zombie parameter being "item_from_Zombies". This way, it only runs one method turning only that one zombie backwards, but not all of the zombies from the list like you had before.

Techique 05-20-2010 07:32 PM

HAHA! i see now thanks alot

Dameria 05-20-2010 07:34 PM

Your welcome, any more questions I am glad to help.

Techique 05-21-2010 11:27 AM

Hey dameria, if you there i was wondering how i could approach ammunition for the guns? i was thinking the same variable as health. but is there an easier way?

Dameria 05-21-2010 03:54 PM

Just use a number variable called "ammo" and set it to the amount you want for that gun. Then, in the method where you shoot, say "if(ammo > 0), do the shoot method and decrement "ammo" by 1. You can then have a reloading method where you do the animation of reloading the gun, and at the end of the animation you do "ammo = (amount of ammo you want in the gun)". Once you do that you will have a system where you only shoot if you have a set amount of ammo in the gun, and once you run out you have to reload.

You can even go a step more realistic (only if you want) and have a limited amount of ammo overall, which could be another number variable called "totalAmmo", and in the reloading method you do "if((amount of ammo you want in gun) > totalAmmo), ammo = (amount of ammo you want in gun) - totalAmmo, else ammo = (ammount of ammo you want in gun)". Tell me if this does not make sense to you and maybe I will make an example.

Watsamax1 05-21-2010 09:13 PM

It makes no sense :(. Id like a ammo system probably infinite ammo but you still gotta reload. I dont get what to do. Like where to put what. Lie put ammo= total ammo if it goes in reload or shoot.

Dameria 05-21-2010 09:14 PM

[QUOTE=Watsamax1;21588]It makes no sense :(. Id like a ammo system probably infinite ammo but you still gotta reload. I dont get what to do. Like where to put what. Lie put ammo= total ammo if it goes in reload or shoot.[/QUOTE]

Do you want me to make an example world?

Watsamax1 05-21-2010 09:26 PM

OMG I LOVE YOU it work it really works!!!!!!!! WWWOOOO:D:D:rolleyes::rolleyes::rolleyes::eek::eek:!!! yeah! thank you. your getting on the credits. Im working no a dinosaur shoot em up. its kinda like Jurassic park/tomb raider 3/ my imagination. Question now is health. :D um like an attack. i plan on if near so many meters t-rex attack. Also cutscene i cannot figure em out.

Dameria 05-21-2010 09:36 PM

[QUOTE=Watsamax1;21590]OMG I LOVE YOU it work it really works!!!!!!!! WWWOOOO:D:D:rolleyes::rolleyes::rolleyes::eek::eek:!!! yeah! thank you. your getting on the credits. Im working no a dinosaur shoot em up. its kinda like Jurassic park/tomb raider 3/ my imagination. Question now is health. :D um like an attack. i plan on if near so many meters t-rex attack. Also cutscene i cannot figure em out.[/QUOTE]

Congrats, and by the way this whole thread is basically about the health system, so you can just look at previous posts to see what I told the other guy to do.

Also, for cutscenes you will have to create boolean variables like "canPlay", and you have to put EVERY method that you can do while playing the game in an "if(canPlay)" if statement before running each method, and drag the code for the method inside the if else statement (remember, EVERY method that allows the player to do something in the game, this includes moving, reloading, shooting methods, etc). You will have to create one of these if/elses for every method that is active while the game is played, but not the cutscenes. Have a the world variable "canPlay" set to true as the initial value (unless you want a cutscene in the beginning, then set it to false and put the code "canPlay = true" at the end of the cutscene). Then at every cutscene method (you will have to create a method for each cutscene and put the animation within that method), you will have to set "canPlay" to false as the first line of code (this will prevent the character from being able to move, shoot, reload, etc) and set "canPlay" to true at the end of the cutscene. Once you do this you should be able to control the cutscene without any interruptions from the player until the cutscene is over.

Tell me if this helped or just made you really confused. If you need help on the cutscenes themselves, that will be harder because that involves creativity, and you have to do that yourself (unless of course you want someone to help you create the actual cutscene to make it more realistic, but then it will not be created by you).

Watsamax1 05-21-2010 09:52 PM

I may get it. But i just noticed if i reload i get infinite ammo and i dont have t reload :confused:

Dameria 05-21-2010 10:07 PM

[QUOTE=Watsamax1;21593]I may get it. But i just noticed if i reload i get infinite ammo and i dont have t reload :confused:[/QUOTE]

What should happen is that you can only shoot the amount of times that there are bullets in the gun, but once the bullets in the clip run out you can reload, putting more bullets in the clip. Are you saying that you never need to reload, and you just keep shooting without it ever stopping? If so then make sure that either the shooting event being called in the events bar, or the entire shooting method itself if within a large if/else statement with what I said in the post before.

If its still not working right, take a print screen and upload the image of the code to the forums (you can black out the animation if you don't want to to see that part) and I can see what you did. If you do this though, make sure everything is showing including the world variables, the method for shooting, and the events bar where you called in the shooting method.

Or you can just ask and I will make a quick example and upload it on this thread. I think that many people will like to see an example anyways because they might be interested in a reloading example for their own worlds.

Watsamax1 05-21-2010 10:39 PM

could it be because i have no bullets yet?
(Edit) possible may of found it i set my ammo and total ammo to 1 to test it i set to 15 again and it stopped. I can make me stop moving for a cutscene. But how do i stop moving the camera? i can stop jumping reloading but the moving i cant. Because i use let arrow keys move < >

Dameria 05-21-2010 10:42 PM

No that shouldn't be the reason. The world.ammo variable should be working as the bullets, the bullet object itself won't really matter much unless you use it as a collision detection to determine when something is hit (although there are other ways to do bullet collision without using actual bullets, but both ways have their pros and cons, so stick with bullets for now). Are you sure you made "ammo" a world variable and not a method variable?

EDIT: You will want to create your own custom movements for moving the camera, because you will not be able to stop it if you use the "let arrow keys move camera". I have to go in 10 minutes, but I will help more tomorrow. You can check some of my recent worlds on how to create custom events to move the camera, just look at the events bar and see how I did "While (up arrow) is pressed, move camera forward 0.1 meters duration 0 seconds" (the duration has to be 0 in order to prevent a world stopping error (I don't know why it produces an error, but it does, and the 0 stops it from doing that)) You can enter in any number for 0.01 to make it go faster or slower.

Watsamax1 05-21-2010 10:58 PM

figured it out. i missed the two up it had to be total ammo > than ammo. works great thank you.

Dameria 05-21-2010 11:00 PM

[QUOTE=Watsamax1;21597]figured it out. i missed the two up it had to be total ammo > than ammo. works great thank you.[/QUOTE]

Your welcome, any other questions just private message me or create a new thread that we can discuss on, this one should be about the other guy and the health system.

Watsamax1 05-21-2010 11:01 PM

Tomorrow is ok. its like 12 am. just im curious is like let <- move camera will that effect collision you can answer it tomorrow.

Dameria 05-22-2010 08:58 AM

Letting the arrow keys move the camera through separate events should be the same thing as letting the arrow keys move the camera in that one event, except that you will also be able to have more control over what happens when you click the arrow keys, like having the option to prevent the camera from moving if its a cutscene.

Watsamax1 05-22-2010 09:54 AM

Could i do ammo so if you get 3 rounds of like 12 shots. then you cannot shoot. Then you get a ammo pack then it sets it all to max? like make a number even have it equal 3 for 3 rounds. and have if reload decrement round by 1 right?

Dameria 05-22-2010 10:19 AM

If by "round" you mean a clip of ammo, then yes, and it would make things a little easier, but it would also waste ammo. For instance, if you have 12 bullets in the gun and only 1 clip of 12 bullets left, what if they shoot 3 times and then reload? What would happen is that you still have 9 bullets left, but because you are reloading, you are emptying what is already in the gun and putting in the last clip, so you will have 12 bullets left instead of 21.

The plus side to what you want to do, however, is that it will make the reloading of your game even more realistic than games like Call of Duty and other large franchise games, because this is what would happen in real life. In real life you only have a certain amount of clips with a certain amount of bullets in one clip, and once your reload, you will lose all of the bullets that you did not use in that clip of ammo, and that is what you want to do, it is more realistic. The reason that big video game companies use the other system, the less realistic one, is because the players would complain about running out of ammo too quickly because they reload after every shot. The way you want to do it will teach people to use their bullets sparingly and only reload once they are very low on ammo in each clip.

Either way is good, you choose which one you want to do.

fenderstrat0409 05-22-2010 11:43 AM

I had this same problem, I just fixed it. Do you have the arrow keys set to control the camera? If so then it's going to do that. So What I did Is I set in a character for myself. "Sheriff" and I made the camera vehicle the sheriff and the arrow keys control the sheriff. It fixed my problem :)

Watsamax1 05-22-2010 12:02 PM

I think you can only reload when done or have few bullets left. yes its a clip of ammo. Id rather my game be a lil harder than others. ammo will b collected by spheres with a gun in it. Health a medic kit. Be kinda cool. also added a night vision not the best but tis ok.

(Edit) i got the spheres to work. Just need to have em move down when clicked on.

Techique 05-22-2010 04:02 PM

Thank you very much for the answer about health variables, and very in depth conversation about ammo :D if i need any more help ill be sure to post it on a new thread.


All times are GMT -5. The time now is 11:52 AM.

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