Shillwil's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
8 (0.01 per day)
Joined:
30-November 12
Profile Views:
1,573
Last Active:
User is offline Mar 02 2013 12:35 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Mac
Favorite Browser:
Chrome
Favorite Processor:
Who Cares
Favorite Gaming Platform:
XBox
Your Car:
Jeep
Dream Kudos:
0

Latest Visitors

Icon   Shillwil has not set their status

Posts I've Made

  1. In Topic: Random Numbers Lab

    Posted 10 Dec 2012

    I got it. We were just introduced to while loops but I figured it out. Just freaked out at first and jumped the gun. My bad.
  2. In Topic: New to HTML

    Posted 3 Dec 2012

    View PostAtli, on 03 December 2012 - 07:01 PM, said:

    Hey.

    Check out this page on Mozilla's dev network. It lists some great HTML tutorials for both beginners and more advanced developers.

    Somebody is always sure to suggest w3schools.com when people ask this question (Google, mostly), and they've got some good stuff. But they've been known to make some mistakes, and be lazy about code styles and other basics. Be warned! :)/>


    Real quick, and I apologize, but what is the difference between HTML and XHTML?
  3. In Topic: Capture the Flag Game

    Posted 30 Nov 2012

    View PosttlhIn`toq, on 30 November 2012 - 10:40 AM, said:

    And the purpose in repeating all of that is what?
    You've repeated the question.
    You've repeated the code the teacher gave you.
    You haven't added anything new to the discussion nor answered my question. Have you made an instance of the LifeBar in your program?

    How about this: You say you can't get it to display. Show us the code from your program (the part you wrote) where you are trying to display the LifeBar.


    I apologize, I literally just joined this website, I was trying to post it publicly like you said. I appreciate your help and the tutorials you've provided. I will talk to my teacher and let him know I need help. Sorry, it's gotta be frustrating dealing w/ someone that's barely learning the code. I appreciate you taking the time to respond to my post. Thanks again!

    I don't believe I've made an instance, I will do that, thank you
  4. In Topic: Capture the Flag Game

    Posted 30 Nov 2012

    View PostShillwil, on 30 November 2012 - 09:58 AM, said:

    Bare with me, I'm new to programming. We have this assignment in my class where we are supposed to create a Capture the Flag game using a LifeBar file our teacher gave us. I've drawn the two characters and eight flags (as required) but I can't get the LifeBar to Draw. I've changed the "namespace" on the LifeBar.cs file to the same as the whole project, but I can't get the actual Lifebar to draw. This is the way our teacher did it but I'm pretty sure I'm missing something.

    bar1.Draw(spriteBatch);
    bar2.Draw(spriteBatch);
    


    I've attached the LifeBar.cs file so whomever chooses to help can get a glance at what I'm dealing with and what I need to do. Anyway, thanks for reading!

    -Shillwil


    View PostShillwil, on 30 November 2012 - 09:58 AM, said:

    Bare with me, I'm new to programming. We have this assignment in my class where we are supposed to create a Capture the Flag game using a LifeBar file our teacher gave us. I've drawn the two characters and eight flags (as required) but I can't get the LifeBar to Draw. I've changed the "namespace" on the LifeBar.cs file to the same as the whole project, but I can't get the actual Lifebar to draw. This is the way our teacher did it but I'm pretty sure I'm missing something.

    bar1.Draw(spriteBatch);
    bar2.Draw(spriteBatch);
    


    I've attached the LifeBar.cs file so whomever chooses to help can get a glance at what I'm dealing with and what I need to do. Anyway, thanks for reading!

    -Shillwil


     namespace Vawdrey_Project_5
    {
        class LifeBar
        {
            //data
            Game game;
            private int hp=400;
            private int barHp = 100;
            private int maxHp=2500;
            private int xPos=20;
            private int yPos=20;
            private int width=150;
            private int height=30;
            private Texture2D image;
            private Color borderColor = Color.White;
            private int thickness = 2;
    
            public int HitPoints
            {
                get { return hp; }
                set { hp = value; }
            }
    
            public int MaxHitPoints
            {
                get { return maxHp; }
                set { maxHp = value; }
            }
    
            public Color BorderColor
            {
                get { return borderColor; }
                set { borderColor = value; }
            }
    
            public int BorderThickness
            {
                get { return thickness; }
                set { thickness = value; }
            }
    
            public int HealthPerBar
            {
                get { return barHp; }
                set { barHp = value; }
            }
    
            public LifeBar(Game g)
            {
                game = g;
                image = game.Content.Load<Texture2D>("Background");
            }
    
            public LifeBar(Game g, int x, int y, int w, int h) : this(g)
            {
                xPos = x;
                yPos = y;
                width = w;
                height = h;
            }
    
            public void Draw(SpriteBatch batch)
            {
                Rectangle full = new Rectangle(xPos, yPos, width, height);
                Rectangle partial = new Rectangle(xPos, yPos, width*(hp%barHp)/barHp, height);
    
                if (hp / barHp > 0)
                    batch.Draw(image, full, Color.Red);
                else
                    batch.Draw(image, partial, Color.Red);
    
                if (hp / barHp > 1)
                    batch.Draw(image, full, Color.Orange);
                else if (hp / barHp > 0)
                    batch.Draw(image, partial, Color.Orange);
                if (hp / barHp > 2)
                    batch.Draw(image, full, Color.Yellow);
                else if (hp / barHp > 1)
                    batch.Draw(image, partial, Color.Yellow);
                if (hp / barHp > 3)
                    batch.Draw(image, full, Color.Green);
                else if (hp / barHp > 2)
                    batch.Draw(image, partial, Color.Green);
                if (hp / barHp > 4)
                    batch.Draw(image, full, Color.Blue);
                else if (hp / barHp > 3)
                    batch.Draw(image, partial, Color.Blue);
                if (hp / barHp > 5)
                    batch.Draw(image, full, Color.Purple);
                else if (hp / barHp > 4)
                    batch.Draw(image, partial, Color.Purple);
    
                //Draw a border border
                batch.Draw(image, new Rectangle(xPos - thickness, yPos, thickness, height), borderColor);
                batch.Draw(image, new Rectangle(xPos + width, yPos, thickness, height), borderColor);
                batch.Draw(image, new Rectangle(xPos - thickness, yPos - thickness, width + 2*thickness, thickness), borderColor);
                batch.Draw(image, new Rectangle(xPos - thickness, yPos + height, width + 2 * thickness, thickness), borderColor);
                 
            }
    
            public void IncreaseHealth(int amount)
            {
                hp += amount;
    
                if (hp > maxHp)
                    hp = maxHp;
                else if (hp < 0)
                    hp = 0;
            }
    
            public void DecreaseHealth(int amount)
            {
                IncreaseHealth(-1*amount);
            }
    
            public void Move(int x, int y)
            {
                xPos = x;
                yPos = y;
            }
    
            public void SetSize(int w, int h)
            {
                width = w;
                height = h;
            }
    
        }
    }
    
    

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
August 3
Gender:
Full Name:
William Alexander Shillingford
Years Programming:
2
Programming Languages:
C#, Objective C, HTML/CSS, PHP

Contact Information

E-mail:
Click here to e-mail me
Skype:
Skype  shillwil000
Twitter:
@Shillwil

Friends

Comments

Shillwil has no profile comments yet. Why not say hello?