Array
Array
CC#
Created by Array on 8/1/2024 in #help
✅ A bit of a beginner qustion, working with data types and variables. I can't seem to get it working
No description
46 replies
CC#
Created by Array on 6/11/2024 in #help
Help designing classes for a game
using System;
using System.Drawing;

namespace Breakout
{
//*************************************************************
//Enums
//*************************************************************
public enum MenuStates { Start, None };
internal class Menu
{
//*************************************************************
//Fields
//*************************************************************
private MenuStates mMenuState;

//*************************************************************
//Constructors
//*************************************************************
public Menu()
{

}

//*************************************************************
//Properties
//*************************************************************


//*************************************************************
//Methods
//*************************************************************
public void Draw(Graphics g)
{

}

}
}
using System;
using System.Drawing;

namespace Breakout
{
//*************************************************************
//Enums
//*************************************************************
public enum MenuStates { Start, None };
internal class Menu
{
//*************************************************************
//Fields
//*************************************************************
private MenuStates mMenuState;

//*************************************************************
//Constructors
//*************************************************************
public Menu()
{

}

//*************************************************************
//Properties
//*************************************************************


//*************************************************************
//Methods
//*************************************************************
public void Draw(Graphics g)
{

}

}
}
Have to design a menu class for a game assignments I'm working in Windows form using my teachers template. I posted somthing similar today earlier but found out my code wasn't any good. I can share the actual file on GitHub if anyone is interested in helping me out or guiding me through it https://github.com/SonicArray3/Breakout
88 replies
CC#
Created by Array on 5/15/2024 in #help
Recursion, help finding the base case?
No description
95 replies
CC#
Created by Array on 5/14/2024 in #help
Understanding Recursion for a complete beginner (Fibonacci Series)
Hey everyone, I hope you are doing well I need some help understanding recursion, can someone explain to me how the base case of the Fibonacci sequence would occur? What would be the base case and then the recursive case?
18 replies
CC#
Created by Array on 4/12/2024 in #help
Blurring an Image in C#, working slowly
Small glitch but my algorithm for making this image blur is running super slow, going from the top of the picture to the bottom. I attached a video showing this, any help
private void mnuProcessBlur_Click(object sender, EventArgs e)
{
//code to Blur
this.Refresh();

if (transformedPic != null)
{
//get height and width of transformed picture
int Height = transformedPic.GetLength(0);
int Width = transformedPic.GetLength(1);
//create temp array to store original transformed pic
Color[,] Temp = transformedPic;
transformedPic = new Color[Height, Width];
for (int row = 0; row < Height; row++)
{
for (int col = 0; col < Width; col++)
{
int TotalRed = 0, TotalGreen = 0, TotalBlue = 0;
int Counter = 0;

for (int i = -1; i <= 1; i++)
{

for (int j = -1; j <= 1; j++)
{
int row2 = row + i;
int col2 = col + j;
if (row2 >= 0 && row2 < Height && col2 >= 0 && col2 < Width)
{
//add colours
TotalRed += transformedPic[row2, col2].R;
TotalBlue += transformedPic[row2, col2].B;
TotalGreen += transformedPic[row2, col2].G;
Counter++;

}
}

}

//Averaging
int AverageR = TotalRed / Counter;
int AverageG = TotalGreen / Counter;
int AverageB = TotalBlue / Counter;
//add to temp
Temp[row, col] = Color.FromArgb(AverageR, AverageG, AverageB);
}
transformedPic = Temp;
this.Refresh();


}



}



}
private void mnuProcessBlur_Click(object sender, EventArgs e)
{
//code to Blur
this.Refresh();

if (transformedPic != null)
{
//get height and width of transformed picture
int Height = transformedPic.GetLength(0);
int Width = transformedPic.GetLength(1);
//create temp array to store original transformed pic
Color[,] Temp = transformedPic;
transformedPic = new Color[Height, Width];
for (int row = 0; row < Height; row++)
{
for (int col = 0; col < Width; col++)
{
int TotalRed = 0, TotalGreen = 0, TotalBlue = 0;
int Counter = 0;

for (int i = -1; i <= 1; i++)
{

for (int j = -1; j <= 1; j++)
{
int row2 = row + i;
int col2 = col + j;
if (row2 >= 0 && row2 < Height && col2 >= 0 && col2 < Width)
{
//add colours
TotalRed += transformedPic[row2, col2].R;
TotalBlue += transformedPic[row2, col2].B;
TotalGreen += transformedPic[row2, col2].G;
Counter++;

}
}

}

//Averaging
int AverageR = TotalRed / Counter;
int AverageG = TotalGreen / Counter;
int AverageB = TotalBlue / Counter;
//add to temp
Temp[row, col] = Color.FromArgb(AverageR, AverageG, AverageB);
}
transformedPic = Temp;
this.Refresh();


}



}



}
27 replies
CC#
Created by Array on 3/19/2024 in #help
Reading in a File 2D Arrays
No description
57 replies
CC#
Created by Array on 3/18/2024 in #help
Reading in a File C# 2D arrays
No description
16 replies
CC#
Created by Array on 2/27/2024 in #help
Using MouseClick Event
https://paste.mod.gg/zlxoaubtbcom/0 Hey guys, I'm working on a code assignment where I have to use Arrays to Reverse, Swap, Clear, Delete or Insert Array Elements, with each element being a colour read in from a file. My teacher has left some parts of comments to help me organize it but I am confused on the MouseClick event - I haven't ever worked with this event before but he gave instructions on it. Any ideas on how to implement it
118 replies
CC#
Created by Array on 2/24/2024 in #help
Help with Arrays in my code?
No description
32 replies
CC#
Created by Array on 12/2/2023 in #help
Can someone explain to me what a bool is and how I can implement it in other data structures?
Pretty much title, I'm trying to code a simple game in C# and my teacher suggested I use booleans to make a certain statement come up given if the boolean was true, can someone explain to me how it works?
644 replies
CC#
Created by Array on 11/15/2023 in #help
can someone explain what a do while statement is to me like im 5
Can anyone explain it to me? Thanks
11 replies
CC#
Created by Array on 11/12/2023 in #help
Files with Visual Studio question - How to add 2 projects from solution to 1 folder?
No description
9 replies
CC#
Created by Array on 11/11/2023 in #help
Programming a menu on WinForms
No description
190 replies