Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Catch the Ball Step3-1
package com.codingwithsara.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
You can’t perform that action at this time.