CodingTrain / CodingTrain/Suggestion-Box

Objects and images 7.8

オープン
#1,503 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
言語のデータがありません
スター
570
フォーク
85
PR マージ指標
30日以内にマージされた PR はありません

説明

In your video you created an array of file names and used CONCATENATE to pass through a link to the image.

I want to use the array [i] to load the image from an array of URL’s, they have no logical file name so I need to reference the array index no. Instead.

I want to click the mouse and a new array index no. Is chosen and the image loaded.

Thanks!

Code:

var urls = [ "https://i.imgflip.com/tau4.jpg", "https://i.imgflip.com/2cp1.jpg", "https://i.imgflip.com/5kdc.jpg", "https://i.imgflip.com/1bgs.jpg", "https://i.imgflip.com/cv1y0.jpg", "https://i.imgflip.com/320xfw.jpg " ];

var bubbles = [];
var memeImg;

function preload() {

vvvvvvvvvvvvv
memeImg = loadImage(urls[3]); **** this loads the urls array index 3 *****
}
^^^^^^^^^^^^^^^ this part needs to random select an index no.

function setup() {
createCanvas(600, 400);


}
function mousePressed(){

var b = new Bubble(mouseX, mouseY, memeImg) ;
bubbles.push(b)
print(bubbles)
}

function draw() {
background(0);
for (var i = 0; i < bubbles.length; i++) {
// bubbles[i].move();
bubbles[i].display();

}
}

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

提供された preload() 関数と mousePressed() 関数から始め、urls 配列と memeImg がどのように使われているかを確認してください。要求されている動作は、マウスクリックで配列のインデックスを選択し、対応する画像を読み込むことですが、payload には実行するリポジトリファイルもテストも記載されていません。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
frontend, web-dev
issue の種類
機能追加
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。