Development android studio [closed]

-3

I would like to know how to get an action in an ImageView, I put a character inside it and wanted it to jump. Remembering, I'm developing a game in Android Studio.

Thank you in advance.

    
asked by anonymous 04.07.2017 / 09:24

1 answer

0

Hello,

I strongly advise not to use an ImageView for animation purposes, but a libgdx library that has support and ease.

But the logic I used would be this for two ImageView . An ImageView that would be in the background and occupy the entire screen in fullscreen . And an ImageView that would match the character at the bottom of the screen.

Something like:

Layout.xml

<ImageView
    android:id="@+id/back"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="fitStart" >
    <ImageView
          android:id="@+id/char"
          android:layout_width="largura da personagem"
          android:layout_height="altura da personagem">
   </ImageView>
</ImageView>

main.java

 int number=100;
 //number corresponderia à posição atual da personagem e a maneira como mudaria no jogo
 ImageView s = (ImageView) findViewById(R.id.char);
 s.setY(number);
 s.setX(number)

I hope to get you started on the game logic

    
04.07.2017 / 11:18