Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Created June 7, 2021 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeforfun-jp/a3eac27085797945433abf6d7de98ae0 to your computer and use it in GitHub Desktop.
Save codeforfun-jp/a3eac27085797945433abf6d7de98ae0 to your computer and use it in GitHub Desktop.
CTB 3-1
package jp.codeforfun.catchtheball;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private TextView scoreLabel;
private TextView startLabel;
private ImageView box;
private ImageView orange;
private ImageView pink;
private ImageView black;
// 位置
private float boxY;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
scoreLabel = findViewById(R.id.scoreLabel);
startLabel = findViewById(R.id.startLabel);
box = findViewById(R.id.box);
orange = findViewById(R.id.orange);
pink = findViewById(R.id.pink);
black = findViewById(R.id.black);
orange.setX(-80.0f);
orange.setY(-80.0f);
pink.setX(-80.0f);
pink.setY(-80.0f);
black.setX(-80.0f);
black.setY(-80.0f);
startLabel.setVisibility(View.INVISIBLE);
boxY = 500.0f;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment