Hi guys!
I’m study game development course and can’t finish assignment and nobody respond me at these course forum, so I came for help here. That what should I do: “Add code to the Game1 GetProjectileSprite method to return the appropriate sprite based on the provided projectile type”
The part of code that I have problem with.
#region Public methods
/// <summary>
/// Gets the projectile sprite for the given projectile type
/// </summary>
/// <param name="type">the projectile type</param>
/// <returns>the projectile sprite for the type</returns>
public static Texture2D GetProjectileSprite(ProjectileType type)
{
// replace with code to return correct projectile sprite based on projectile type
return null;
}
This is code for ProjectileType class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GameProject
{
///
/// An enumeration of the projectile types
///
public enum ProjectileType
{
FrenchFries,
TeddyBear
}
}
I already Loaded sprites. And I tried few things, but I’m getting error after my code.
Error CS0161 ‘Game1.GetProjectileSprite(ProjectileType)’: not all code paths return a value
This is my code
#region Public methods
/// <summary>
/// Gets the projectile sprite for the given projectile type
/// </summary>
/// <param name="type">the projectile type</param>
/// <returns>the projectile sprite for the type</returns>
public static Texture2D GetProjectileSprite(ProjectileType type)
{
// replace with code to return correct projectile sprite based on projectile type
if (type.Equals(ProjectileType.FrenchFries))
{
return frenchFriesSprite;
}
if (type.Equals(ProjectileType.TeddyBear))
{
return teddyBearProjectileSprite;
}
Please Help!