Duel Academy
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Duel Academy Log in

Get your game on!


descriptionSum halp with programming EmptySum halp with programming

more_horiz
Umm is there anyone here that wouldn't mind giving sum halp to hope in javascript?
Im messing up the most basic of things since i took a looooong break from it..
So umm, firstly.. i can't get the double "for" loop to work.

Code:

for(var i = 0;i < 700; i+=100){
   var nomy = i;
   for(var v = 0;v < 700; v+=100){
      var nomx = v;
      ctx.fillRect(nomx,  nomy, nomx+100; nomy+100);}
      }

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Easy. Use this:

for(var i = 0;i < 700; i+=100){
var nomy = i;
for(var v = k.;v < 700; v+=100){
var nomx = v;
ctx.fillRect(nomx, nomy, nomx+100; nomy+100);}
}

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Dis is seriuz!! Y u troll me centrik :C

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Because you don't let us 3some lulu.

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
You have some odd fetishes..

but really now, im starting to go mad over a bloody loop...

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
You can contact Irate.

I don't know if Irate can program but k. that should help you a bit.

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Nah im not gonna go around bugging people, if someone actually replies to the chat with a solution then cool, if not then i'll just cry myself to sleep

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Nah im not gonna go around bugging people, if someone actually replies to the chat with a solution then cool, if not then i'll just cry myself to sleep

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Try separating the tags something like this

Code:

for(var i = 0;i < 700; i+=100){
  var nomy = i;
}
  for(var v = 0;v < 700; v+=100){
      var nomx = v;
      ctx.fillRect(nomx,  nomy, nomx+100; nomy+100);}
      }


I'm not sure if works though I'm still a beginner myself in JS.

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Well umm the idea here is to use the double "for" loop to make a sort of a big square from little ones.
So the the first one is in charge of the vertical bit and the second one is the horizontal, basically what i want it to do is make a line of squares and then drop down and make the second line etc till it's 7x7.
Naturally i could type all of the squares out separately, but i'd like to use 6-7 lines of programming rather than 49.

Thanks for trying to help though

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Work your curly braces.

Code:

for( init; condition; increment ) {
 body;
 for( init2; condition2; increment2 ) {
  body2;
 }
}

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Isn't that what i got already?

for(var i = 0;i < 700; i+=100){

  var nomy = i;

  for(var v = 0;v < 700; v+=100){

     var nomx = v;
     ctx.fillRect(nomx,  nomy, nomx+100; nomy+100);

                }
     }

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Bump? mb?

EDIT: Ignore me!!! JESUS FKING CHRIST IT WAS A SEMICOLON INSTEAD OF A NORMAL ONE......................................................................................



I feel like an absolute idiot... sweating over a doubleloop..

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Lol, this is funny

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
watch inception movie, it might help ya Razz

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Might do... sigh.. i got another one that just doesn't make sense

Code:

function squares(){
   for(var i=1;i<ruudud.length;i++){   
   if(ruudud[i].pool == 1){
      ctx.drawImage(img,ruudud[i].locx,ruudud[i].locy);
      }
   else{
      ctx.drawImage(img2,ruudud[i].locx,ruudud[i].locy);
      }
   }
}


The images are loaded, so no problems with the reference, but apparently something isn't quite right..  Can i not use the "i" in the if condition? or is it another bloody typo...


EDIT: AND IT WAS... it was another typo....
im just gonna stop posting here cuz every time im stuck it's because im an idiot >.>

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
It seems you are able to solve your problem whatever it is after posting it here, DA's magic.

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
why not just simply use a program that will execute and debug the code for ya and find you all these syntax mistakes lol.

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
Just a hint, your JS style is horrible, but I already have you on Skype so you can get ready for many more discussions.

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
how was that a hint? seems more like a statement to me

descriptionSum halp with programming EmptyRe: Sum halp with programming

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply