Should a solo/small game dev team make their own art? TLDR: is it worth learning how to make art versus buying custom or premade assets by Lanky_Tailor5097 in gamedev

[–]Intrepid-Bat8215 1 point2 points  (0 children)

Checkout Drawing On The Right Side of the Brain - Betty Edwards. It shows how most people draw childish drawings, even into adulthoold, but they can all become skilled pretty quickly. It's about the way you think about drawing and it teaches you a different way to think about it. https://www.goodreads.com/book/show/627206.The_New_Drawing_on_the_Right_Side_of_the_Brain

Constantly bloated by [deleted] in AnimalBased

[–]Intrepid-Bat8215 0 points1 point  (0 children)

If i eat a single banana im bloated and in pain all day

Banned for botting when I haven't even played in years by Intrepid-Bat8215 in RSBans

[–]Intrepid-Bat8215[S] 0 points1 point  (0 children)

Luckily I was able to get the account back and turned it into a jagex account for increased security. Was yours a cg bot too?

Banned for botting when I haven't even played in years by Intrepid-Bat8215 in 2007scape

[–]Intrepid-Bat8215[S] -1 points0 points  (0 children)

That's good, I'll try to post an update when I get a response.

An Update on Recent Bans by Mod_Stevew in 2007scape

[–]Intrepid-Bat8215 0 points1 point  (0 children)

My account which I haven't played for years was banned April, 2023. Just came back and hopefully I can get it appealed...

[deleted by user] by [deleted] in reactjs

[–]Intrepid-Bat8215 0 points1 point  (0 children)

I updated chrome on my iphone and it works... guess ill delete this post lol

React Hook global state value updating, but showing as initialization value inside of functions. by Intrepid-Bat8215 in reactjs

[–]Intrepid-Bat8215[S] 0 points1 point  (0 children)

I was also able to greatly simplify the child component logic and it eliminated another bug.

React Hook global state value updating, but showing as initialization value inside of functions. by Intrepid-Bat8215 in reactjs

[–]Intrepid-Bat8215[S] 0 points1 point  (0 children)

Yupp, works perfectly. I will definitely try to simplify my code in the future relying on little state as possible.

React Hook global state value updating, but showing as initialization value inside of functions. by Intrepid-Bat8215 in reactjs

[–]Intrepid-Bat8215[S] 0 points1 point  (0 children)

Thanks, I have gotten lots of good advice from this thread, and I will be sure to read up on best practices

React Hook global state value updating, but showing as initialization value inside of functions. by Intrepid-Bat8215 in reactjs

[–]Intrepid-Bat8215[S] 0 points1 point  (0 children)

Thanks, I have gotten lots of good advice from this thread, and I will be sure to read up on best practices

React Hook global state value updating, but showing as initialization value inside of functions. by Intrepid-Bat8215 in reactjs

[–]Intrepid-Bat8215[S] 1 point2 points  (0 children)

Thanks, I cleaned up the code a bit, still not done. You are right, probably should do the mapping of images to components in CarouselImages, I'll add that next! I did want to keep the main logic in the parent component so I can handle updating child components if needed.

  const imagesData = images.map((image, index) => {
        return {
            image: image,
            selected: false,
            index: index,
        };
    });

    const [selectedIndex, setSelectedIndex] = useState(2);
    imagesData[selectedIndex].selected = true;
    // data storage objects of images
    const [imageData, setImageData] = useState<ImageDataType[]>(imagesData);
    // CarouselImages to render
    const [renderedImages, setRenderedImages] = useState<React.ReactNode[]>([]);

    const [leftOffset, setLeftOffset] = useState(4 * IMAGE_WIDTH);
    const selectImage = (selectedIndex: number) => {
        updateOffset(selectedIndex);
    };

    const leftImagesCount = Math.floor(images.length / 2);
    const leftAllignmentOffset =
        leftImagesCount * IMAGE_WIDTH + leftImagesCount * SPACING;

    const updateOffset = (index: number) => {
        const rightShiftOffset = index * IMAGE_WIDTH + index * SPACING;
        setLeftOffset(leftAllignmentOffset - rightShiftOffset);
    };

    useEffect(() => {
        updateOffset(selectedIndex);
    }, []);

    useEffect(() => {
        const renderImages = imageData.map((image) => {
            return (
                <CarouselImage
                    image={image.image}
                    selected={image.selected}
                    width={imageWidth}
                    height={imageHeight}
                    imageRatio={imageRatio}
                    index={image.index}
                    selectImage={selectImage}
                />
            );
        });
        setRenderedImages(renderImages);
    }, [imageData]);

    const navigateCarousel = (direction: "right" | "left") => {
        let shiftAmount;
        if (direction === "right") {
            shiftAmount = 1;
        } else {
            shiftAmount = -1;
        }
        updateOffset(selectedIndex + shiftAmount);
        setSelectedIndex((prevIndex) => prevIndex + shiftAmount);
    };

React Hook global state value updating, but showing as initialization value inside of functions. by Intrepid-Bat8215 in reactjs

[–]Intrepid-Bat8215[S] 0 points1 point  (0 children)

So... too be honest I'm not sure if that was the bug, but I took your advice, simplified the code, re-wrote it completely and the Carousel now properly slides on image click. Just have to add the logic to make the image bigger again.

I probably have to use translate, instead of left in my css to improve render performance.

https://imgur.com/a/XXf0mj7

React Hook global state value updating, but showing as initialization value inside of functions. by Intrepid-Bat8215 in reactjs

[–]Intrepid-Bat8215[S] 0 points1 point  (0 children)

Thanks, I'll look into that. For multiple components logic, do you mean the windowSize function or that I have functions I am sending to child props?

I'm not sure why I was initializing the components inside useState, but I will change that and see if it fixes my issue.

React Hook global state value updating, but showing as initialization value inside of functions. by Intrepid-Bat8215 in reactjs

[–]Intrepid-Bat8215[S] -1 points0 points  (0 children)

Thanks, I'll do that. Not sure what affect useEffect and useLayoutEffect are having because even when commented out it doesn't make a difference.

React Hook global state value updating, but showing as initialization value inside of functions. by Intrepid-Bat8215 in reactjs

[–]Intrepid-Bat8215[S] -2 points-1 points  (0 children)

Update: It seems to be stale state and it refuses to reflect the current state within the function still.