Ryan Watkins (Mentor)

Ryan Watkins (Mentor)

Undergrad studying Computer Science at University of Reading. I am the founder of a software startup and love to hack around in all programming languages.

Location Reading, UK

Activity

  • Please see below lokesh

  • Very strange Jose, I pasted your code in and ran it fine.

    Instead I would reimport the entire project and repaste your current TheGame code.

  • Thank you very much for your feedback Adrian

  • There is a paddle that hits the ball Ferran.

    The idea (after a few weeks) is to hit the ball into smiley balls and score points. The game is similar to Breakout and Pong.

  • Do you mean another game's source code?

    I believe you search around on Github, there will be other examples of Android games that you can take a look at.

  • That's completely normal :)

  • Yup, the SDK allows for that and I believe you can do design inside Android Studio (placing buttons and so on)

  • That's fine Maria, that's just the keystore, if you keep going through the generate signed apk process, you'll eventually end up with an .apk file.

    You can check here for how to generate a signed apk: http://stackoverflow.com/questions/16622843/how-do-i-export-a-project-in-the-android-studio/19876060#19876060

  • No problem, glad to hear it worked :)

  • Yup you need an array of sadballs, whereby each one counts how many hits it has and destroys accordingly when the number of hits has been reached.

  • I don't believe so, but perhaps Android (the OS itself) is saying it doesn't have enough RAM to operate properly because it has a page file that may get full upon operation. I would recommend removing any unnecessary images/video/apps on your phone (you should only need around 100mb more space).

    This is the case with any app.

    It might use more memory...

  • Hi Stephen,

    I've just took it upon myself to implement this.

    The key is to create a Bitmap that you wish to change the smiley ball to.

    For instance on line 59, I initialise an mUnSmiley variable using the sad_ball image.

    Then on line 179 (inside the part where I have my collision handled on my smiley), I call the function 'changeSmileyFace()' which...

  • Hi Eva,

    It was the way you were setting up your mSmiley.

    You did not initialise the mSmileyY variable to be any useful value. When you drew the smiley, you were calling on mCanvasHeight - mSmiley.getHeight() * 8 which is something mSmileyY did not match. Instead it should be mSmileyY - mSmiley.getHeight() / 2 and mSmileyY should be initialised to some...

  • Hi John,

    I've fixed your code for you, you can take a look here: http://pastebin.com/6QspaY0Z

    The key differences are in line 153, line 160 & line 161.

    Let me know if you have any more questions.

  • Hi Peter,

    It should be fine, the course will be around for enough time for you to complete it :)

  • Hi Lokesh,

    Try doing the following:

    Go to Preferences > Gradle and ensure that the "Offline work" checkbox is not checked.

  • The course should be around for a while, so you should have enough time :D

  • You get a compile error.

  • Hi Fan,

    What difficulties are you currently facing?

    We can provide some help :)

  • Okay so I did some digging.

    In line 136/137 in GameThread.java, mCanvasWidth/mCanvasHeight are initialised as the device's width and height. If you arbitrarily try getting mCanvasHeight just inside TheGame's class definition before the function setSurfaceSize() inside GameThread has been run, you will only find a value of 1.

  • Semantics (what you are trying to accomplish), so regardless of whether you had the right idea about something. Syntax is the language (keywords in a programming language such as 'int' or 'for' and so on.).

  • Hi Neil,

    I'm glad you enjoyed the course! The course will indeed be available for a while so don't worry :)

  • Very awesome Karolina!

  • Thanks for your feedback Karolina

  • Hi Tony,

    I have a few resources for you:

    YouTube tutorial series for Android App Development - https://www.youtube.com/watch?v=Mjjuk3Fac84&index=10&list=PLGLfVvz_LVvSPjWpLPFEfOCbezi6vATIh

    Another great book - http://www.amazon.com/dp/0321804333//ref=cm_sw_su_dp?tag=nethta-20

    Good luck with your future learning!

  • Hi Martin,

    Here seems like a great place to go to for some continued learning: https://www.youtube.com/watch?v=Mjjuk3Fac84&index=10&list=PLGLfVvz_LVvSPjWpLPFEfOCbezi6vATIh

  • Any luck Tomislav?

  • Hi Roland,

    On second thoughts this book seems to be way better: http://www.amazon.com/dp/0321804333//ref=cm_sw_su_dp?tag=nethta-20

  • Hi Darsh

    This video should run you through OOP a bit more: https://www.youtube.com/watch?v=lbXsrHGhBAU

  • Hi Steve,

    Seems like you had the right line of thought with the manifest.

    Here's an article addressing your question: https://blog.grandcentrix.net/how-to-install-different-app-variants-on-one-android-device/

  • Good to hear Dharmendra :)

  • Welcome Jeremiah, good luck with the course! Feel free to ask us mentors any questions!

  • Welcome Julie, good luck with the course! Feel free to ask us mentors any questions!

  • No Edmund.

    You just need to install JDK7 and Android Studio, googling both terms and downloading should set you on your way.

  • You need to download Android Studio and likewise JDK 7, if you look for those on Baidu or Google it should be fine.

  • You can find these in the original game files you downloaded when you started the course. You should be able to open one of the versions and paste it into TheGame.java and have that week's version accordingly.

  • Hi Mohammed,

    Please do the following:
    1. Run cmdline as Administrator and execute: bcdedit /set nx AlwaysOn
    2. Restart your computer
    3. Try installing Intel HAXM again

    Let me know how it goes.

    Source: https://software.intel.com/en-us/forums/android-applications-on-intel-architecture/topic/494876

    R

  • You can cast to different types. i.e. (float) arr[i]

  • I agree on the Android Studio part of things. There is good news though, they are just about to release Android Studio 2.0, you can read about it here: http://android-developers.blogspot.co.uk/2015/11/android-studio-20-preview.html

  • Cool stuff Adam, good job. Indeed I would look at clearing the code up a bit to make it look more elegant. :)

  • Good idea Joe.

  • That's a great idea Malcolm, I would also like to see this!

  • Hi Hikmatu,

    In this case I would suggest restoring the code to one of the versions in the original code download (i.e. v1.txt -> v7.txt)

  • Hi Caleb,

    Please make sure you have enough hard drive space before downloading. Here is an alternative download link: http://www.softpedia.com/get/Programming/Other-Programming-Files/Android-Studio.shtml

  • Hi NUR NASRI,

    I believe there is code to be uncommented as you go further that should deal with this situation. If all else fails, try copying in v2.java into TheGame.java.

  • Hi Obengo,

    You can download the IDE here: http://developer.android.com/sdk/index.html

  • Hi Aisha,

    You can download the IDE here: http://developer.android.com/sdk/index.html

  • Feel free to ask us for help if necessary :)

  • Hi Andrew, perhaps you could restore your code to something from the folder that contains the weekly code. For instance, if you are on week 4, you could open v4.java and paste that into TheGame.java

  • Hi O.B.,

    Try commenting out the actionWhenPhoneMoved function

  • Good to hear Dave, good luck with the rest of the course

  • Could you please send a screenshot to us via www.postimg.org? Have you imported a project upon opening Android Studio?

  • Do you have sufficient space on your device Rynagh? Also try this: http://stackoverflow.com/questions/4226132/app-not-installed-error-on-android

  • Oh okay, sometimes deploying to a local android device is better. Good luck with the course.

  • Hi Elzbieta,

    Could you provide us with a screenshot of which icons are missing? Also, I would just import the project again, the code will still remain from last time (provided it was saved)

  • Sounds like a good idea Steve

  • Very good Nathan, haha

  • Hi Wandy,

    As far as I can see from just taking a look at some Google results, it shouldn't lead to any major problems. But, if it does, please let us know. Good luck with the course.

  • Hi Michael, it does make a difference in Python (which forces you to write clean code) :D

  • Don't forget the readability benefits, sometimes it's easier to hide away what the function does and just call the function name (which describes the overall job)!

  • Hi Alexander,

    That makes sense now :)

  • You're welcome Sergey

  • Hi Dave, right click the application shortcut and select Run as Administrator and see if that fixes things (I'm assuming you are on Windows)

  • Good to hear Rangzeb! Good luck with the course

  • Hi Jaspreet, have you received any other message? Have you enabled the option to install apps from unknown sources?

  • Unfortunately not, iPhone's run on iOS and this course requires android devices. You can however use an emulator inside of the software Android Studio.

  • Hi Antone,

    Seems like you may have a low spec computer, perhaps you may wish to lower the resolution and memory given to your emulator to see a speed increase.

  • Hi Israel, please see my response below to Alexander

  • Hi Pallav,

    Could you screenshot your android studio and show us?

  • Glad to see you are enjoying it David.

  • Don't be afraid to figure it out for yourself, go and look into the other java files and debug through your code! See what happens line by line, good luck! :D

  • What is the reasoning behind not being able to download and install the android sdk? Perhaps I can help.

  • Hi James,

    I understand your bad points, which are unfortunately, part of having a small course for beginners. However, all is not lost. There is a lot of information on-line and I feel like you should be able to dive into the other pieces of code and be able to understand a bit, or at least, you should be trying to mess with these pieces of code to...

  • This is because it constantly calls getScore() and keeps realising it is more than or equal to five and increasing the speed. I would create a boolean variable called hasScoreUpdatedSpeed in the class definition itself to act as a 'flag'. And change the if statement to the following:

    if (!hasScoreUpdatedSpeed && getScore() >= 5) {
    hasScoreUpdatedSpeed...

  • I agree, but it depends on the size of the function as to whether or not it is clear that one return statement will only be hit if it doesn't go into an if statement. If your function is very long and your if statement is long, then I agree with you. Sometimes however, it may be better to reduce the lines of code (if the function is clear) and you can clearly...

  • Perhaps I can clarify?

    So, when creating a function, we can specify whether we want it to be public or private.

    Public means, that any class can call your function provided that has an instantiated object of that class. An object is just a variable that allows you call functions from that class, for instance int, string & float are all classes and have...

  • Please see updateBallCollision in v6.java.

  • Go to v6.java and you can find the updateBallCollision function (paste all the code in to your TheGame.java)

  • He has defined it, perhaps he did not run through it entirely but if you look at 3:57, you can see it clearly.

  • Could very well be your processor yes Rangzeb

  • Very good Steve, keep us updated on how it goes. I think you could really take the game quite far :D

  • So glad to hear that Mark, good job! :)

  • Are you tilting your device to the right Mike?

  • Hi Vidullatha,

    If you were to take the square root for distanceBetweenBallAndPaddle, you would also have to take the square root of mMinDistanceBetweenBallAndPaddle.

    And yes, it would work - I just tried it myself.

    My code is here: http://pastebin.com/86s0p1Nm

  • Yup - good :D

  • Be wary of these types of loops Galyna, it's unsure whether the code will hit an error because we do not know if myArray is of size >= 4. If the size if three, it'll hit an error.

  • Hi Sreerag,

    The course will stay a long time after the last week has elapsed so stick around and take the course at your own pace.

  • Hi Jiao, good luck!

  • For me, it was the realisation that arrays are a data structure for optimization. It's essentially telling the compiler, look, I want some elements reserved in memory, one after the other because they are related and have the same type (i.e. int or string, or ClassX). For instance foo[0] is the start of the array, foo[1] = foo[0+8] for instance, depending on...

  • Too easy! We need more destruction... :D

  • Good idea, I think the angry ball should catch on fire though

  • Hi Mark,

    Perhaps this stackoverflow post will help you along the way: http://stackoverflow.com/questions/29047902/how-to-add-an-image-to-the-drawable-folder-in-android-studio

    :) R

  • I feel the exact same about my laptop too