All pastes #1932312 Raw Edit

SideScroller

public java v1 · immutable
#1932312 ·published 2010-09-04 07:34 UTC
rendered paste body
package com.zombiearmy.videogame;import android.view.MotionEvent;import com.stickycoding.rokon.Scene;import com.stickycoding.rokon.Sprite;import com.stickycoding.rokon.background.FixedBackground;public class GameScene extends Scene {    private FixedBackground background;    private Sprite ship, as1;        public GameScene() {        super(1, 3);        setBackground(background = new FixedBackground(Textures.background));                //declare bobs                ship = new Sprite(25, VideoGame.GAME_HEIGHT / 2, Textures.bob.getWidth(), Textures.bob.getHeight());        ship.setTexture(Textures.bob);                as1 = new Sprite(200, VideoGame.GAME_HEIGHT / 2, Textures.asteroid.getWidth(), Textures.asteroid.getHeight());        as1.setTexture(Textures.asteroid);                //line.show();        //add to first layer (0)               add(0, ship);        add(0, as1);    }    @Override    public void onGameLoop() {//set all motions in here    	as1.x-=2;    	if(as1.x<=-32){    		    	as1.x=VideoGame.GAME_WIDTH+ 16;    	}    	as1.rotate(2);    }    @Override    public void onPause() {    }    @Override    public void onResume() {    }        @Override    public void onTouchMove(float x, float y, MotionEvent event, int pointerCount, int pointerId) {       	    	//Ship moves on the y axis with your finger    	ship.y = y - (Textures.bob.getHeight() / 2);    	    	    }	@Override    public void onReady() {   //like the Create() method in GM    }}