Welcome to PlagueFest.com! Log in or Sign up to interact with the Plague Fest community.
  1. Welcome Guest! to interact with the community and gain access to all the site's features.

Tutorial my first tutorial:rotating changing color sprite around a gun

Discussion in Resources & Tutorials started by Super Mario, May 14, 2012

  1. Oct 17, 2011
    Posts
    Hi and welcome to my first tutorial. Today, i will teach you how to do a rotating sprite around a gun and sprite color change every 5 seconds. For this tutorial, you will need these four entities:

    [IMG]

    1. Any weapon entity ( i will use weapon_p90)

    2. An invisible brush (size does not matter but use less then 16x16)

    3.env_spriterail entity

    4. Logic_timer entity



    Step 1: weapon_p90

    Let's start off with the weapon first. Double click on the weapon and it will show the class info. Here is what you need to do for the class info:

    1. Name: i will use "weapon_p90" as a name

    2. Go from class info to Flags and check start constrained if you want to.

    Hit apply and close it after you are done. Here is what the class info of the weapon_p90 should be like after it's done.

    [IMG]



    Step 2: invisible brush

    Second step will be the invisible brush which is the pink box next to the gun in the first picture. Click once on the invisible brush and press ctrl+t to give it an entity. Make the entity func_rotating. The class info for this would be:

    1. Name: i will use "weapon_p90_rotate" for my tutorial

    2. Parent: weapon_p90 or the name of the weapon that you gave. Now the brush will follow the gun wherever it goes

    3. Max rotation speed: mine will be default(100)

    4. Go from class info to Flags and only leave checked: Start on Not solid Large sound radius

    All the other options are not really importat unless if you want to do anything with them but i gave the most important for this step. Hit apply and close it after everything is done. Here is what the invisible brush class info should have before you close it

    [IMG]

    Now, when you make sure everything is good, click on the brush and move it exactly in the middle of the gun. For more info, check this image

    [IMG]



    Step 3: Env_spriterail entity

    The third step will be the spriterail entity which is the white box entity shown in figure 1. Double click on that spriterail and here is the class info that should be changed:

    1. Name: I will use "sprite" for this tutorial

    2. Parent: Weapon_p90_rotate (invisible brush). Now the sprite will follow the invisible brush and rotate with it which will make it look like it is following the gun)

    3. Lifetime: This is how much the sprite lasts from where it starts moving. For my opinion, do not leave it 0.5 because it sucks and will not show up very good. I will use 5 (seconds) which will make it stretch and last longer before it disappears from where it started after 5 seconds.

    4. Start width: I will use "16"

    5. End width: I will use "2"

    6. Sprite name: Browse for whatever sprite you would like but i will keep mine default.

    7. Fx color (R.G.B.) : This is what the sprite color will be. I will pick blue sprite.

    Flags: nothing.

    Hit aply and close it after it's done. To make sure everything is correct, here is a pic of the class info and what it should be like:

    [IMG]



    Step 4: Logic_timer

    Last step is the logic_timer. That entity will cause the sprite color to change with a specific time. Double click on the entity and here is the class info

    1. Name: I will use "weapon_p90_timer" for my tutorial

    2. all the others stay default

    3. Refire interval: (will come back to that later)

    Flags: nothing

    Ok, let's go to the outputs. The logic_timer outputs will fire the sprite change color. Hit add and make the output:

    My output named: OnTimer

    Target entities named: Sprite

    Via this input: Color (type it because hammer does not have this input command). It will show up in red and as an error because hammer thinks it's wrong but it will work, so do not worry about that problem and do not hit fix if you go to check for problems because it will rewin the output.

    With a paramater override: this is important. Leave the output as it is for now and close it and make a new entity spriterail for a test only and finding the color value. After making the test env_spriterail, go to Fx color and browse for the colors. My next color will be red. Pick the red color for this entity and hit ok. After, numbers will appear on the class info on the right side that are the number value for the rec color as shown in this picture:

    [IMG]

    Copy the number value and go back to the logic_timer output and paste it in With a parameter override. The red color value is 255 0 0 which should appear on the parameter after pasting it.

    After delay in seconds: 5 (for my tutorial). Now, 5 seconds after logic_timer is fired, the sprite will change to red.

    My next color will be pink. Go back to the test env_spriterail and pick the color pink which will have a different value fx color on the right side. Copy that new value and go back to the logic_timer and make a new output which will have the same as the first but different paramater and override. Paste the fx color value of the pink into the parameter override and put 10 for the delay in seconds. After doing this, we now have blue sprite onmap spawn that will change to red after 5 seconds and pink 5 seconds after the red toggles.

    It will be the same thing as with the other colors that i will go with. Add a new output with the same thing but different paramater and add "5" for the delay in seconds each time you start a new one. I will use 8 colors for my tutorial. It can be more or less depending on however you want. So here are the following next colors i used for this tutorial:

    Yellow (15 seconds), Light green(20 seconds), Dark red(25 seconds), Light blue(30 seconds), Purple(35 seconds), blue "again"(40 seconds)

    Here is a screenie of my outputs of the colors that i used in the logic_timer after i was done adding the fx color values and adding 5 seconds to the delay:

    [IMG]

    Also, remember to ignore the error that hammer gives for this.

    Ok, so now the mission of the logic_timer is to refire the same thing again after all the sprites are toggled.Go back to the class info of the logic_timer and go to the refire interval that we skipped at the beginning. Ok, the last color that was fired was the blue after 40 seconds. For the refire interval, it tells the time for that logic_timer to start from the first color again and refire the whole thing from the beginning. After blue is toggled after 40 seconds, i want the red color to fire again 5 seconds after it, so the refire interval time is 40 seconds and the red will toggle again after delay 5 seconds. We now have the same sprite color change again. It will go from one color to the other every 5 seconds and will refire from blue again every 40 seconds continously untill a new round begins.Keep in mind that the sprites will not start changing colors untill 45 seconds after map spawn because the refire interval will fire 40 seconds after map spawn but there is a way where you can make it start changing colors at the beginning of mapspawn (will show it in extra step)

    Here is a picture of what the class info of the logic_timer should be like after it is done:

    [IMG]

    Extra step: Logic_relay or logic_auto

    Make a logic_relay on your map and copy and paste all the outputs from the logic_timer to the relay and change all the my output named to Onspawn instead of OnTimer). It is the same with logic_auto but change my output named to Onmapsapwn. This will fire the sprites once ever map spawn and stop after 45 seconds and then the logic_timer will run them again and refire them every 45 seconds till round ends.

    One more thing. You can also drag the same sprite multiple times by holding Shift and moving it elsewhere and keep the same name options unless if you want to make it with different colors, change only the name to "sprite 2" and use the same logic_timer and logic_relay or logic_auto but with different fx color values.



    Thank you for watching my first tutorial. I hope this guide was very helpful. Please if you have any questions about this or something else, tell me and i will help. My steam account name is "mariosoury" I hope my grammar was good in my first tutorial and i will also be making more. If you find any mistake, please tell me because i did all of this on a paper before i started typing it and i did not take minutes and hours on my first tutorial but 3 days working on it in school when i had free time and testing everything at home and giving as much explanation as i can. Also, this is a video of this tutorial of how it works and sorry that it was only 30 seconds because i don't have the full version of fraps


    via http://www.youtube.com/watch?v=EGi2FfRxeNU&feature=youtube_gdata_player


    I also thank @Jermaine [pF] for letting me know about infranview
    • Useful Useful x 5
    • Informative Informative x 2
      Super Mario, May 14, 2012 Last edited by Super Mario, May 15, 2012
    • Apr 20, 2011
      Posts
      Ahhhh....... what that mean lol
    • Oct 17, 2011
      Posts
      What part of the tutorial don't you understand? Ask any questions here chet. I still do not get what you mean by that.
    • Feb 12, 2012
      Posts
      Good tut Mario, nicely detailed and organized. Goodjob :grin:
      • Like Like x 1
      • May 14, 2011
        Posts
        You know you can resize the box with all the parameter to make it really small? You don't need all that white space. But besides that its a great tut!

        And you should parrot fraps or hypercam3.

        also: http://www.colorpicker.com/

        Also if you use a logic relay... You can optimise the number of entities. To 1

        In the logic relay:

        OnSpawn - (logic relay name) - Trigger - (none) - (the refire interval you want) <-- you should always use this instead of a timer unless you want a random time. This is because it elimates the fact that the timer fires first after the first cycle. (this is how that part of a logic_timer entity is made)
        OnSpawn - (env_sprite name) - Color - R G B - (delay you want it to change colour after)

        This gets rid of the logic_timer

        Also, the same timer system can be used for all the env_sprite entites, just add loads of outputs to it.




        • Informative Informative x 1
          Ghost, May 15, 2012 Last edited by Ghost1995, May 15, 2012
        • Feb 14, 2012
          Posts
          Well done on the tutorial. I notice this technique being used in several levels.
        • Oct 17, 2011
          Posts
          It was actually my first time using infran view and I did now know how to resize and do these but thank you ghost and all of you guys for liking this tut. I will think of a new one tomorrow.