1
Guys, I couldn’t find a post like this. So send me the link if you find one.
With a huge problem, I am creating a game of those that the ball has to break squares on the screen and I have everything ready, except the squares to be broken.
My problem is that I create a block object with the block data. And when I do:
var bloco = new bloco(posiçãox,posiçãoy)
I create a block on the screen, but when I make another block, I can’t. Or when the var
has a different block name.
I tried to:
var bloco2 = new bloco.constructor();
but I don’t know where to insert the object parameters (posx e posy)
;
Does anyone know how to help me? I have to do some 270 and I can’t do it manually because they appear randomly on the screen.
Objects are in the context of a canvas 2d.
Hello Ramon, welcome to Stackoverflow. You could make a Fiddle with the example cited so that we can stay more in the context?
– Jedaias Rodrigues
The link https://jsfiddle.net/n58pkm02is here/
– Ramon Lago
It didn’t have to be the whole game, my friend, just the part where you’re in trouble.
– Jedaias Rodrigues
For no doubt I put all the code, because it has a sequence of "loops" to show and interact with the elements, I thought that the error could n be only in the object, but in other elements as well. but the error is in the "block" object.. I want to throw several of it.. colors will be random, punctuation and other elements will do after you can generate the "copies" of the block
– Ramon Lago
after you are ready let me know I want to play!!! rsrsrs
– SneepS NinjA
Thanks Galera.. I’ve managed to make all the blocks appear, inserting them in an array. Now each has its own ways and everything else. Thanks!
– Ramon Lago