✅ Creating interactive objects in Blazor

So i decided to pick up Blazor and to that end, I decided to port a winforms game i made to a blazor webassembly app. The problem i am facing is that i am unsure how to create the objects for the game. For reference, it is a brick breaker game where there are bricks, a bat, walls and the ball. On winforms i used the System.Drawing extension to get this done, and used a collision detection on the ball to rebound when they contact any of the components. I'd like to know how i can draw these ibjects on blazor ty.
8 Replies
Mayor McCheese
Mayor McCheese3mo ago
This sounds like a lot of JavaScript work, and you won't have easy access to JavaScript, it's likely a bad choice.
Yordle_Breeder
Yordle_Breeder3mo ago
You think so? I thought i'd just makde some razor components for the objects and style them with like tailwindcss i alreeady have the game logic and everything done
Mayor McCheese
Mayor McCheese3mo ago
if you're going that route then sure You can store your game state as a static singleton probably and reference it in components. I've done this with toast messages and such before. I'm not certain how you'll manage the ball moving towards bricks though
Yordle_Breeder
Yordle_Breeder3mo ago
Yah actually, it will have to redraw the page everytime. Now that i think about it, this project might not be feasible
Mayor McCheese
Mayor McCheese3mo ago
I mean you can probably do something with css transitions but realistically you're not really getting much from blazor.
Yordle_Breeder
Yordle_Breeder3mo ago
What do you mean
Mayor McCheese
Mayor McCheese3mo ago
Most the work is going to be html/css if you go the transitions route, I don't know much about that space tbh, but I don't think blazor gets you too much there, it's just another web framework at that point.
Yordle_Breeder
Yordle_Breeder3mo ago
Hmm, i see what you mean tbh, the only other is to use javascript like you mentioned