Skip to content

Instantly share code, notes, and snippets.

@robsbots
robsbots / gist:9509545
Last active August 29, 2015 13:57
Week 3 Code update
//This is run just before the game "scenario" is printed on the screen
@Override
protected void updateGame(float secondsElapsed) {
float distanceBetweenBallAndPaddle;
float distanceBetweenBallAndSmiley;
if (mBallSpeedY > 0){ // If the ball is moving down the screen do this block
// Removed ball speed calculations to after the "if ball hits paddle" code
// Only need to change the speed/direction if a hit is detected. Otherwise leave it alone
// # This is a copy of my current code at then end of week 3
// # You can download some instructions and the sound files I used in a zip file from
// # http://www.robsbots.org.uk/files/mooc/sounds.zip
// # You will need to extract the contents into a folder on your computer,
// # then open the instructions.txt file to explain how to enable sound.
// #
package uk.ac.reading.sis05kol.mooc;
//Other parts of the android libraries that we use
import android.graphics.Bitmap;
/* This starts a "multi line comment
This ends a multi line comment */
/* Anything within a comment is ignored so you can put what ever you like in a comment.
This can go on for line after line.
The last line should finish with */
/* This can be very handy when writing software.
If you write a new piece of code, you can put comments around the old piece and test out a new part
*/
/*
################################################################################################
# #FLMobiGame FutureLearn Begin Programming #
# End of week 4 code #
# #
# Sound added with the use of the SoundPool library #
################################################################################################
*/
package uk.ac.reading.sis05kol.mooc;
package uk.ac.reading.sis05kol.mooc;
//Other parts of the android libraries that we use
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.media.MediaPlayer;
public class TheGame extends GameThread{
//Will store the image of a ball
private Bitmap mBall;
//The X and Y position of the ball on the screen (middle of ball)
@robsbots
robsbots / TheGame.java
Last active August 29, 2015 13:57
Game file as of week 5. Sounds, lives, ball speed up on score
package uk.ac.reading.sis05kol.mooc;
//Other parts of the android libraries that we use
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.media.AudioManager;
import android.media.SoundPool;
@robsbots
robsbots / GameThread.java
Created March 24, 2014 12:23
GameThread as of week 5. Only one line needs chaning. This is for the soundpool setup
package uk.ac.reading.sis05kol.mooc;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.os.Bundle;
@robsbots
robsbots / activity_main.xml
Created March 24, 2014 12:31
activity_main.xml The layout file from /res/layout/
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<uk.ac.reading.sis05kol.mooc.GameView
android:id="@+id/gamearea"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<RelativeLayout
/****************************************************************************
* odd_func.c
*
* Strange function definition test
*
* Can you define one function inside another and have it compile ?
* Apparently you can.
* We can have local functions.......
* Neither of these local function can be called from outside their scope.
*
<?php
// File name:- server_config.php
// Configuration settings for Mail server
define('SMTP_SERVER', 'smtp.gmail.com');
define('SMTP_PORT', 587);
define('SMTP_USERNAME', 'your_gmail_user_name');
define('SMTP_PASSWORD', 'your_gmail_password');
define('SMTP_AUTH', true);
define('SMTP_AUTH_TYPE', 'tls');