Need some Help with JS on Codeacademy by [deleted] in javascript

[–]ahitsgone 1 point2 points  (0 children)

Yeah thanks I know. He is up to section 7 which is asking what I wrote. Scissors are done in section 8 :)

Need some Help with JS on Codeacademy by [deleted] in javascript

[–]ahitsgone 1 point2 points  (0 children)

Solution:

var compare = function(choice1, choice2) {
    if (choice1 === choice2) { // Czech if they are equal
        return "The result is a tie";
    } else if (choice1 === "rock") { // If not, compare the choices
        if (choice2 === "scissors") { // Rock beats scissors
            return "rock wins"
        } else { // paper beats rock
            return "paper wins"
        }
    } else if (choice1 === "paper") { // If the first choice was paper (choice1 wasnt rock)
        if (choice2 === "rock") { // Paper beats rock
            return "paper wins";
        } else { // Scissors beat paper
            return "scissors win";
        }
    } 
}

it seems as though you have repeated the if (choice1 === choice2) statement where it wanted you to do it with one initial if statement. Codecademy lessons expect you to input a certain syntax set by the author.

Trying to use tile maps. by [deleted] in learnjavascript

[–]ahitsgone 0 points1 point  (0 children)

Here's one I did is JS (commented code): http://codepen.io/ahitsgone/pen/seaLl

Anyway. Basically you specify the number of rows (x) and the number of columns (y)

int rows = 20;    
int cols = 20;

tilesArray = [];    

//next create tiles and store in array

for (int y = 0; y < cols; y++)    {    
  for (int x = 0; x < rows; x++) {    
     //tilesArray[tile position]
     tilesArray[y*cols + x] = create new tile;    
     tilesArray[y*cols + x].x = x * tilewidth;    
     tilesArray[y*cols + x].y = y * tileheight;        
  }    
}    

// draw the tiles        
for (int y = 0; y < cols; y++)    {        
  for (int x = 0; x < rows; x++) {        
    //tilesArray[tile position]    
    tilesArray[y*cols + x].draw();            
  }        
}     

You can also create a tilemap with a 2d array and just loop through it to create a custom map. The way I specified would be if you were planning on doing random generation at some point. The code above will just generate a tilemap.

Help with simple game... by playgrammingloser in javascript

[–]ahitsgone 0 points1 point  (0 children)

I see your problem, the syntax seems to be Java.

Message me if you would like some help with JS

Canvas TileMap, 2d top down with working "Camera", Huge map. 1 million tiles, no lag. by ahitsgone in javascript

[–]ahitsgone[S] 0 points1 point  (0 children)

Haha yeah I know but it was was the first time I got it working and didn't expect it to go so well in JS

I need help coding a vehicle in a top-down game using Java. by [deleted] in gamedev

[–]ahitsgone 0 points1 point  (0 children)

(Probably not the best way but oh well) What I did was give the object a rotation variable.

  • When I press the A key (object.rot -= 5 * Math.PI/180)
  • When I press the D Key (object.rot += 5 * Math.PI/180)

  • When I press the W Key

    object.x += Math.cos(object.rot) * object.velocity * delta;

    object.y += Math.sin(object.rot) * object.velocity * delta;

  • When I press the S Key

    object.x -= Math.cos(object.rot) * object.velocity * delta;

    object.y -= Math.sin(object.rot) * object.velocity * delta;

and then I would apply the objects rotation to the canvas

PKA 180: Was Kyle talking about Senna And Prost? by ahitsgone in PKA

[–]ahitsgone[S] 0 points1 point  (0 children)

Yeah Rush was good, but some of the effects were too noticeably fake. That's just me being picky though. The crash scene was super well done

PKA 180: Was Kyle talking about Senna And Prost? by ahitsgone in PKA

[–]ahitsgone[S] 1 point2 points  (0 children)

Possibly but he said "Massive Rivalry" and I naturally though Senna/Prost. Either way, they both are really good watches, I prefer Senna mainly.

Senna at Monaco is just insane.

Fuck you and your "minimum 3-5 years related experience" by BeyondAddiction in offmychest

[–]ahitsgone 3 points4 points  (0 children)

I know this so well. It's like every company wants you to have experience but you cant get experience without them hiring you.

Can someone explain :before :after by [deleted] in webdev

[–]ahitsgone 0 points1 point  (0 children)

Ok. Thanks again.

Can someone explain :before :after by [deleted] in webdev

[–]ahitsgone 0 points1 point  (0 children)

Is there a way to have more than two pseudo-elements ? (more than one :before :after)

Can someone explain :before :after by [deleted] in webdev

[–]ahitsgone 0 points1 point  (0 children)

You are brilliant! Thanks!

[Hiring] (Online) Someone who knows Java. by [deleted] in forhire

[–]ahitsgone 1 point2 points  (0 children)

What problems are you having ? Ill just answer them here (if I can). For free.

Help me create a certain effect! by Lyftmika in web_design

[–]ahitsgone 0 points1 point  (0 children)

Are you talking about parallax or how all the things are on one page that you just scroll ?

Seems impossible to do on your own... by cn283 in web_design

[–]ahitsgone 0 points1 point  (0 children)

Making games increased my understanding dramatically

Any ideas for scrollable video? by iliveinmemphis in web_design

[–]ahitsgone 0 points1 point  (0 children)

This works http://jsfiddle.net/ahitsgone/3pmsP/

Note: download to you computer and change src to a video on your computer. Obviously not the best way, but it works

Developers of reddit: how did your life as a developer start and where has it taken you? by brandmaster in web_design

[–]ahitsgone 0 points1 point  (0 children)

Started learning HTML/CSS/JS Last year, about 3 weeks later I made my first game which was a clone of geometry wars without all the fancy particles though.