[問題] 如何寫出一直產生金幣
各位版上大大打擾了 小弟我目前正在為專題努力 > <
有遊戲開發的問題想請教一下
目前瓶頸是卡在不知如何寫連續產生金幣
金幣的移動方向(由右到左)
很類似薑餅人大逃亡這樣的方式 http://ppt.cc/0rXn 非惡意連結:)
那小弟也Google了不少資料
其中有找到一個網站 他們寫了一個飛機向敵機發射子彈
有分享程式碼
以下為他的子彈程式碼(Bullet.java)
package cn.m15.xys;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
public class Bullet {
/**子彈的X軸速度**/
static final int BULLET_STEP_X = 3;
/**子彈的Y軸速度**/
static final int BULLET_STEP_Y = 15;
/**子彈圖片的寬度**/
static final int BULLET_WIDTH = 40;
/**子彈的XY座標**/
public int m_posX = 0;
public int m_posY = 0;
/**子彈的動畫**/
private Animation mAnimation = null;
/**是否更新繪製子彈**/
boolean mFacus = false;
Context mContext = null;
public Bullet(Context context, Bitmap[] frameBitmap) {
mContext = context;
mAnimation = new Animation(mContext, frameBitmap, true);
}
/**初始座標**/
public void init(int x, int y) {
m_posX = x;
m_posY = y;
mFacus = true;
}
/**繪製子彈**/
public void DrawBullet(Canvas Canvas, Paint paint) {
if (mFacus) {
mAnimation.DrawAnimation(Canvas, paint, m_posX, m_posY);
}
}
/**更新子彈的座標點**/
public void UpdateBullet() {
if (mFacus) {
m_posY -= BULLET_STEP_Y;
}
}
}
該遊戲參考網址:http://www.xuanyusong.com/archives/304
那麼小弟在理解程式碼時
發現他是使用者在螢幕上點一下 就發射子彈
那麼有有沒有辦法是
從右到左一直產生金幣呢??
懇請各位大大幫忙惹 >"<
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.127.184.51
※ 編輯: j7789417 來自: 59.127.184.51 (09/15 12:11)
→
09/15 15:34, , 1F
09/15 15:34, 1F
推
09/16 16:28, , 2F
09/16 16:28, 2F
推
09/18 07:51, , 3F
09/18 07:51, 3F
→
09/18 07:51, , 4F
09/18 07:51, 4F
→
09/18 07:51, , 5F
09/18 07:51, 5F