- 狀態:按空白鍵
- 動作:發射子彈
- IF 按空白鍵 THEN 發射子彈
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<meta name="description" content=""> | |
<meta name="author" content=""> |
/** | |
* Minim-emulation code by Daniel Hodgin | |
*/ | |
// wrap the P5 Minim sound library classes | |
function Minim() { | |
this.loadFile = function (str) { | |
return new AudioPlayer(str); | |
} | |
} |
練習:用暴力的方式,找出最小值
解答:
class Car {
// property
float speed ;
// Construct Method
Car (int initSpeed){
speed = initSpeed ;
宣告一個裝 int 的 array ,有 5 格
格子依序填進 1 ~ 5
把每一個格子都 + 1
Javascript code that calculates how much active time is spent on a tab and takes into account changing tabs, switching windows, or leaving the page.
Demo here http://bl.ocks.org/d/4393523/
// 請下載空白作業 4 檔開始。 | |
PImage[] flames = new PImage[5]; | |
int[] flameFrameCount = new int[5]; // 這個火焰經過幾次系統影格了 -> 被 draw 了幾次 -> 便可透過 frameRate 來轉換成畫了幾秒。 | |
int[] flameX = new int[5] ; | |
int[] flameY = new int[5] ; | |
int boomIndex = 0 ; // 現在要用哪一來儲存爆炸狀態 -> 同時也代表,我要去用 array 的第幾格存。 | |
int yourFrameRate ; |
var todoUndoneClass = "list-group-item" , | |
todoDoneClass = "list-group-item list-group-item-success" | |
// 把事件註冊在 todo 的母階層 | |
document.getElementById("todo-todoList").addEventListener(function(e){ | |
// 母階層裡面的物件 | |
if(e.target.className === todoDoneClass){ | |
e.target.className = todoUndoneClass | |
}else { |