xxxxxxxxxx
43
//Make her listen to the question
//Make her respond with the headlines only close to you
var state = 0;
var url = 'https://api.nytimes.com/svc/topstories/v2/world.json?api-key=a65aff26acee41528286255c6b07c42b';
var img;
var article1;
function setup() {
loadJSON (url, gotData);
var btn1 = createButton('HOW WOULD I NOW?');
btn1.position (20,60);
var btn2 = createButton('HOPE');
btn2.position (200,60);
var btn3 = createButton ('THE FRUITS OF WHAT WE SOW TODAY');
btn3.position (20,90);
btn1.mousePressed(answerOne);
//document.getElementById("article1").innerHTML = "HELLO2";
}
function answerOne(){
createP ("Well I wouldn't think it would be hard to say if you knew that " + tuSuerte);
var button1A = createButton (´EXCEPT THAT IS NOT IMPORTANT´);
}
function draw() {
clear();
}
// var inp1 = createInput('');
// inp1.position (8,60);
// inp1.input(myInputEvent);
// article1=select ("#article1");
function gotData (heads){
var randomHeads = int (random(0, heads.results.length));
println (randomHeads);
tuSuerte = heads.results[randomHeads].title;
//erase the previous result and place the new one
}