• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
NUCLEAR RABBIT

Maybe I don't quite understand Activities & Intents...

2 posts in this topic

Hello, So I am trying to put an activity that displays a picture in the beginning of my app for 2 seconds and then goes to another activity where the user tries to guess the computers number. The MainActivity works fine, Problem is, when I add the new activity (splash) to the manifest file, and change the splash activity as the launcher and the main activity to default for the intent category, it doesnt run anymore! Can someone pleeease help me understand what I am doing wrong...

 

MainActivity.java

package com.bwall.thenumbergame;

import java.util.Random;

import android.os.Bundle;
import android.app.Activity;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.view.View;

public class MainActivity extends Activity {
	
	// global variables
	int number, compNumber;
	EditText textField;
	TextView result, gameObjective;
	Button button;
	Random rand = new Random(System.nanoTime());
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		// setting views
		textField = (EditText) findViewById(R.id.textField);
		result = (TextView) findViewById(R.id.resultView);
		gameObjective = (TextView) findViewById(R.id.gameObjective);
		button = (Button) findViewById(R.id.submitButton);
		
		// creating computer number
		compNumber = rand.nextInt(10);
		    
		button.setOnClickListener(new View.OnClickListener() {
				
			@Override
			public void onClick(View v) {
				number = Integer.parseInt(textField.getText().toString());
					
				// checks if correct guess
				if(number == compNumber) {
					result.setText("CORRECT! The nummber was " + compNumber);
				} else {
					result.setText("LOL nope. Guess Again.");
				}
			}
		});
	}
}

 

Splash.java

package com.bwall.thenumbergame;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

public class Splash extends Activity {
	
	final Context context = this;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.splash);
		
		Thread timer = new Thread() {
			public void run() {
				
				try {
					Thread.sleep(2000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				} finally {
					Intent mainIntent = new Intent(context, MainActivity.class);
					startActivity(mainIntent);
				}
			}
		};
		timer.start();
	}
	
	@Override
	protected void onPause() {
		super.onPause();
		finish();
	}
}

 

splash.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/splashbackground"
    android:orientation="vertical" >

</LinearLayout>

 

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/gameObjective"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="30dp"
        android:text="@string/gameObjective"
        android:textSize="30sp" />

    <EditText
        android:id="@+id/textField"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/gameObjective"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="15dp"
        android:ems="10"
        android:inputType="number" />

    <requestFocus />

    <Button
        android:id="@+id/submitButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textField"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="19dp"
        android:text="@string/submitButton" />

    <TextView
        android:id="@+id/resultView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/submitButton"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="58dp"
        android:textIsSelectable="true" />

</RelativeLayout>

 

TheNumberGame Manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bwall.thenumbergame"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.bwall.thenumbergame.Splash"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="com.bwall.thenumbergame.SPLASH" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.bwall.thenumbergame.MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>

</manifest>
Edited by NUCLEAR RABBIT
0

Share this post


Link to post
Share on other sites

Your game should only have a single activity and intent.  

 

Some apps may have multiple intents.  For example, you may open a map application to run it, or you may use it for navigation, or you may want to open a street view.  That would be three intents for a single application.

 

For playing a game you really have only one intent.  A user won't probably say "I want to look up my address book contact using this game", or say "I want to open this pdf file using the game", or "I want to navigate to an address using the game".   Those would be different intents for the application.  They almost never apply to games.

 

 

 

If you decide to use a splash screen (deep sigh, see Strategy's post) then it should be as part of your game.  Although I detest splash screens, I do understand that they are sometimes there for corporate branding requirements, and other times they are useful to hide the fact that you are loading resources.  In the second case they are a necessary evil.

 

Whatever your reason for it, your splash screen should simply be your initial game state.  You start in the "showing splash screen" state.  Then when the time expires you transition to your main menu state.

 

 

On the other hand..... If you did decide to make your splash screen into its own application with its own intent, it will be blissfully easy to swap it out with a non-splash-screen empty app.  So in that case your users might be happy for your action since it means they can trivially bypass or remove your splash screen.

Edited by frob
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0