»Helping GC

Discussion in 'Off-Topic' started by jamil, Feb 5, 2016.

  1. jamil

    jamil Journeyman Member

    Messages:
    30
    Ratings:
    +11 / -0
    Hi arjen pro can i help GC with my ultimate coding skillz lol...

    I am not 21 firstly like it says on my profile xD.... my name is jamil/JK_BUILDZ i am 12... a pestering android programmer who would love to contribute to GC for 100% free
    Dont judge me please and email me at [email protected] or reply to this forum...
    I appreciate a single reply.. it means more than alot to me..

    sincerly,

    the craziest android programmer in the whole friking universe,

    JK_BUILDZ/jamil

    ps: I started programming at the age of 6!

    please follow up you both will make my day if you do...... it means alot once again

    @Arjenpro @aXed
     
    #1
  2. Arjenpro

    Arjenpro Member Member

    Messages:
    67
    Ratings:
    +327 / -0
    Can you show me some things you made? ;)
     
    #2
    • Agree Agree x 1
  3. jamil

    jamil Journeyman Member

    Messages:
    30
    Ratings:
    +11 / -0
    @Arjenpro I am in the making of an app.. lol i can show you something i made from a tutorial at team treehouss!!!!!

    @Arjenpro you are very kind this means alot, its a big step!(im only a 12yr old pro xD)

    @Arjenpro quiz me on some code... and amke it some triky java pls
     
    Last edited by a moderator: Feb 28, 2016
    #3
  4. Swag_Fox

    Swag_Fox Head Admin Staff Member HeadAdmin

    Messages:
    4,165
    Ratings:
    +3,200 / -0
    Well,I saw u ing To anni (Swag_Fox) I guess u can make very good things for Gc ♥ Good luck :)
     
    #4
    • Agree Agree x 1
  5. jamil

    jamil Journeyman Member

    Messages:
    30
    Ratings:
    +11 / -0
    package com.jamil.goldfrenzy;

    import android.content.Context;
    import android.content.SharedPreferences;
    import android.content.res.Resources;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.graphics.Canvas;
    import android.graphics.Color;
    import android.graphics.Paint;
    import android.graphics.Typeface;
    import android.util.DisplayMetrics;
    import android.util.Log;
    import android.util.TypedValue;
    import android.view.Display;import android.view.MotionEvent;
    import android.view.SurfaceHolder;
    import android.view.SurfaceView;
    import android.view.WindowManager;import android.widget.TextView;

    import com.jamil.goldfrenzy.thread.MainThread;

    import java.util.ArrayList;
    import java.util.List;
    import java.util.Locale;
    import java.util.Random;

    public class MainGamePanel extends SurfaceView implements SurfaceHolder.Callback {
    private static final String TAG = MainGamePanel.class.getSimpleName();

    private MainThread thread;
    private boolean gameStarted = false;
    private boolean gamePaused = false;
    private Button start;
    private Cart cart;
    private Button retry;
    private Button pause;
    private Button play;
    private List<FallingItem> fallingItems = new ArrayList<FallingItem>();
    Random randomGenerator = new Random();
    Bitmap bit_cart = BitmapFactory.decodeResource(getResources(), R.drawable.cart_sprite);
    Bitmap bit_pause = BitmapFactory.decodeResource(getResources(), R.drawable.pause);





    public MainGamePanel(Context context) {
    super(context);
    // adding the callback (this) to the surface holder to intercept events
    getHolder().addCallback(this);



    // create the game loop thread
    thread = new MainThread(getHolder(), this);
    // make the GamePanel focusable so it can handle events
    setFocusable(true);

    }

    @Override
    public void surfaceCreated(SurfaceHolder surfaceHolder) {

    // create cart and load bitmap
    Bitmap bit_play = BitmapFactory.decodeResource(getResources(), R.drawable.start);
    cart = new Cart(bit_cart, getWidth()/2, getHeight()-bit_cart.getHeight());
    Log.d(TAG, "height of screen -" + getHeight());
    Log.d(TAG, "bit height - " + bit_cart.getHeight());

    start = new Button(BitmapFactory.decodeResource(getResources(), R.drawable.start), getWidth()/2 - bit_play.getWidth()/2, getHeight()/2 - bit_play.getHeight()/2);
    play = new Button(BitmapFactory.decodeResource(getResources(), R.drawable.start), getWidth()/2 - bit_play.getWidth()/2, getHeight()/2 + bit_play.getHeight()/4);
    pause = new Button(BitmapFactory.decodeResource(getResources(), R.drawable.pause),bit_pause.getWidth()/2,bit_pause.getWidth()/2);


    // create the game loop thread
    thread = new MainThread(getHolder(), this);
    thread.setRunning(true);
    thread.start();

    }

    @Override
    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

    }

    @Override
    public void surfaceDestroyed(SurfaceHolder holder) {
    boolean retry = true;
    while (retry) {
    try {
    thread.join();
    retry = false;
    } catch (InterruptedException e) {
    // try again shutting down the thread
    }
    }
    }

    public void createAFallingItem() {
    if (gameStarted){

    int rnd = randomGenerator.nextInt(12);
    FallingItem item;
    if (rnd == 8) {
    item = new Chest(BitmapFactory.decodeResource(getResources(), R.drawable.coin_chest), getWidth());
    item.getSpeed().setYv(3);

    } else if (rnd == 7 || rnd == 5 || rnd == 10 || rnd == 1) {
    item = new Bomb(BitmapFactory.decodeResource(getResources(), R.drawable.bomb), getWidth());
    item.getSpeed().setYv(4);

    } else if (rnd == 6) {
    item = new FreezeBlock(BitmapFactory.decodeResource(getResources(), R.drawable.freeze_block), getWidth());
    item.getSpeed().setYv(4);

    } else {
    item = new Coin(BitmapFactory.decodeResource(getResources(), R.drawable.coin_orginal), getWidth());
    item.getSpeed().setYv(3);
    }
    fallingItems.add(item);
    }

    }


    @Override
    public boolean onTouchEvent(MotionEvent event) {
    Log.d(TAG, "Coords: x=" + event.getX() + ",y=" + event.getY());
    Log.d(TAG, "Width: " + getWidth() + " height" + getHeight());

    if (event.getAction() == MotionEvent.ACTION_DOWN && pause != null) {
    pause.detectTouched(event);
    if (pause.isTouched()) {
    gamePaused = true;
    }
    }

    if (event.getAction() == MotionEvent.ACTION_DOWN && start != null) {
    start.detectTouched(event);
    if (start.isTouched()) {
    gameStarted = true;

    }
    }

    if (event.getAction() == MotionEvent.ACTION_DOWN && play != null) {
    play.detectTouched(event);
    if (play.isTouched()) {
    thread = new MainThread(getHolder(), this);
    thread.setRunning(true);
    thread.start();
    play.setDisplayed(false);
    }
    }

    if (!cart.isFrozen() && !cart.isBombed()) {
    cart.getSpeed().setXv(Cart.DEFAULT_SPEED);

    if (event.getX() < getWidth() / 2) {
    if (cart.getLastDirection().startsWith("right")) {
    cart.getSpeed().toggleXDirection();
    }
    Log.d(TAG, "You pressed on the left");
    cart.setLastDirection("left");
    //we are moving left so show left moving
    } else {
    if (cart.getLastDirection().startsWith("left")) {
    cart.getSpeed().toggleXDirection();
    }
    Log.d(TAG, "You pressed on the right");
    cart.setLastDirection("right");
    //we are moving right so show right moving
    }

    if (event.getAction() == MotionEvent.ACTION_UP) {
    cart.getSpeed().setXv(0);
    if (cart.getLastDirection().equals("left")) {
    cart.setLastDirection("left stop");
    } else {
    cart.setLastDirection("right stop");
    }
    }
    }

    //whenever the cart is bombed, we check if the
    //user pressed on the coordinates of the retry button
    if (cart.isBombed()) {
    if (event.getAction() == MotionEvent.ACTION_DOWN && retry != null) {
    retry.detectTouched(event);
    if (retry.isTouched()) {
    cart.setScore(0);
    cart.setBombed(false);
    cart.setX(getWidth()/2);
    cart.setY(getHeight()- bit_cart.getHeight());
    thread = new MainThread(getHolder(), this);
    thread.setRunning(true);
    thread.start();
    retry.setDisplayed(false);
    }
    }
    }

    return true;
    }
    public void update() {
    for (FallingItem fallingItem : fallingItems) {
    if (!fallingItem.isErased()) {
    if (cart.isThereCollision(fallingItem)){
    fallingItem.setErased(true);
    cart.increaseScore(fallingItem, getContext());
    } else {
    fallingItem.update();
    }
    }
    }

    //check collision with right wall if heading right
    if (cart.getSpeed().getxDirection() == Speed.DIRECTION_RIGHT
    && cart.getX() + cart.getBitmap().getWidth() >= getWidth()) {
    return;
    }
    // check collision with left wall if heading left
    if (cart.getSpeed().getxDirection() == Speed.DIRECTION_LEFT
    && cart.getX() <= 0) {
    return;
    }
    // Update the lone cart
    cart.update();
    //cartAnimated.update(System.currentTimeMillis());
    }
    private String avgFps;
    public void setAvgFps(String avgFps) {
    this.avgFps = avgFps;
    }

    public void render(Canvas canvas) {
    if (canvas != null) {
    if (!gameStarted) {
    canvas.drawColor(Color.GRAY);
    start.draw(canvas);
    } else {
    if(cart.isBombed()) {
    canvas.drawColor(Color.GRAY);
    thread.setRunning(false);
    int oldScore = PreferenceUtils.getScore();
    if (cart.getScore() > oldScore) {
    displayNewHighScore(canvas, getContext());
    PreferenceUtils.saveNewScore(cart.getScore());
    /*Bomb(canvas);*/
    }


    displayGameOver(canvas, getContext());
    // txt.draw(canvas);
    return;
    }
    /*if(cart.isChested()){
    Chest(canvas);
    }
    if(cart.isCoined()){
    Coin(canvas);
    }
    if(cart.isFrozen()){
    Ice(canvas);
    }*/
    if (gamePaused) {
    canvas.drawColor(Color.GRAY);

    play.draw(canvas);
    displayPauseWriting(canvas, getContext());
    thread.setRunning(false);
    gamePaused = false;
    pause.setDisplayed(false);
    } else {
    canvas.drawColor(Color.GRAY);
    cart.draw(canvas);
    pause.draw(canvas);
    for (FallingItem fallingItem : fallingItems) {
    if (!fallingItem.isErased()){
    fallingItem.draw(canvas);
    }
    }
    // display score
    displayScore(canvas, getContext());
    start.setDisplayed(false);
    }

    }
    }
    }


    private void displayScore(Canvas canvas, Context context) {
    if (canvas != null) {
    float density = context.getResources().getDisplayMetrics().density;
    Typeface plain = Typeface.createFromAsset(getContext().getAssets(), "fonts/LCD_Solid.ttf");
    Typeface bold = Typeface.create(plain, 1);
    Paint paint = new Paint();
    paint.setTypeface(plain);
    paint.setARGB(255, 255, 255, 255);
    paint.setTextSize(20*density);
    canvas.drawText(String.valueOf(cart.getScore()), this.getWidth()/2 + this.getWidth()/2, this.getHeight()/2 + this.getHeight()/2, paint);
    }
    }

    /*private void Coin(Canvas canvas) {
    if (canvas != null) {
    Typeface plain = Typeface.createFromAsset(getContext().getAssets(), "fonts/LCD_Solid.ttf");
    Typeface bold = Typeface.create(plain, 1);
    Paint paint = new Paint();
    paint.setTypeface(plain);
    paint.setARGB(255, 255, 255, 255);
    paint.setTextSize(20);
    canvas.drawText("KA_CHING!", this.getWidth()/ 2 - 50, this.getHeight()/2 - 20, paint);
    }
    }
    private void Bomb(Canvas canvas) {
    if (canvas != null) {
    Typeface plain = Typeface.createFromAsset(getContext().getAssets(), "fonts/LCD_Solid.ttf");
    Typeface bold = Typeface.create(plain, 1);
    Paint paint = new Paint();
    paint.setTypeface(plain);
    paint.setARGB(255, 255, 255, 255);
    paint.setTextSize(20);
    canvas.drawText("KA-BOOM!",this.getWidth()/ 2 - 50, this.getHeight()/2 - 20, paint);
    }
    }
    private void Chest(Canvas canvas) {
    if (canvas != null) {
    Typeface plain = Typeface.createFromAsset(getContext().getAssets(), "fonts/LCD_Solid.ttf");
    Typeface bold = Typeface.create(plain, 1);
    Paint paint = new Paint();
    paint.setTypeface(plain);
    paint.setARGB(255, 255, 255, 255);
    paint.setTextSize(20);
    canvas.drawText("CREAK!", this.getWidth()/ 2 - 50, this.getHeight()/2 - 20, paint);
    }
    }
    private void Ice(Canvas canvas) {
    if (canvas != null) {
    Typeface plain = Typeface.createFromAsset(getContext().getAssets(), "fonts/LCD_Solid.ttf");
    Typeface bold = Typeface.create(plain, 1);
    Paint paint = new Paint();
    paint.setTypeface(plain);
    paint.setARGB(255, 255, 255, 255);
    paint.setTextSize(20);
    canvas.drawText("SMASH!", this.getWidth()/ 2 - 50, this.getHeight()/2 - 20, paint);
    }
    }*/



    @Arjenpro
     

    Attached Files:

    #5
    • Pew Pew x 1
  6. jamil

    jamil Journeyman Member

    Messages:
    30
    Ratings:
    +11 / -0
    @Arjenpro the rest didnt fit that was from my gamepanel or my main activity in the studio

    uh yeah... call me a geek!

    @Swag_Fox thanx man i feel so happy now!!! finally a good comment..
    so can i talk to axed and create someting for GC!!

    @aXed please give me a chance i love GC (cough*much better than shotbow*cough)

    @Arjenpro I am on your profile and apparently u are lookking at this thread!
     
    Last edited by a moderator: Feb 28, 2016
    #7
    • Pew Pew x 1
  7. moek

    moek Honorary Poster Member

    Messages:
    425
    Ratings:
    +122 / -0
    The fact when you said you were 12 made them laugh 1 and 2) Why would they hire a kid to do a mans job lol? Coding is serious work and not a joke
     
    #7
  8. jamil

    jamil Journeyman Member

    Messages:
    30
    Ratings:
    +11 / -0
    @moek u can shut ur mouth becauseu don't even know what the word means. I am serious about it and I am in the middle of creating a stable android app. I know html,css,JS,Java,and SQL, and I would like to contribute I am not a shit kid who goes on the hour of code and starts coding scroll up in this thread to see MY code

    Plus why is this ur business, Give a kid a chance it will open up a future for him . Jeeez
     
    Last edited: Feb 6, 2016
    #8
    • Agree Agree x 2
    • Friendly Friendly x 1
  9. OMGMINECRAFT [C.A.D]

    OMGMINECRAFT [C.A.D] Honorary Poster Member

    Messages:
    416
    Ratings:
    +236 / -0
    hes 12 its ok...
     
    #9
  10. Wastefellow

    Wastefellow Member Member

    Messages:
    68
    Ratings:
    +30 / -0
    This is a block game were talking about, if you dont have anything nice to say dont say it at all
     
    #10
    • Agree Agree x 1
  11. jamil

    jamil Journeyman Member

    Messages:
    30
    Ratings:
    +11 / -0
    @Wastefellow mate I want to help gc creating stuff from code in your block game
    wastefellow also thanks for standing up for me

    @Pretty lol xD I don't get u

    @OMGMINECRAFT [C.A.D] tnx man

    @Arjenpro so what do you think

    Guys actually Scroll up to see my code

    @Pretty idc anyway but thanks for coming on the thread!
     
    Last edited by a moderator: Feb 28, 2016
    #11
  12. minecrafter77

    minecrafter77 Quick Digit Member

    Messages:
    203
    Ratings:
    +49 / -0
    good luck :)
     
    #14
  13. Parth Kasat

    Parth Kasat Quick Digit Member

    Messages:
    246
    Ratings:
    +42 / -0
    Well i am a java coder...cant say anything about Android codes xD
     
    #14
  14. PeterG

    PeterG Enthusiast Member

    Messages:
    121
    Ratings:
    +54 / -0
    It looks like you have potential on becoming some sort of coding developer for GC, I wish you the best of luck. To anyone saying that jamil cant do a job like this, I suggest keeping your mouth shut unless you have legitimate proof of him not being able to do it, just because he is 12 does not mean he cannot be mature and good at coding.
     
    #15
  15. jamil

    jamil Journeyman Member

    Messages:
    30
    Ratings:
    +11 / -0
    Last edited by a moderator: Feb 28, 2016
    #15
  16. ServerMask

    ServerMask Quick Digit Member

    Messages:
    285
    Ratings:
    +35 / -0
    I hope gc will be fucking beatiful with u! :)
     
    #16
  17. Soga

    Soga Forum Guru Member

    Messages:
    2,063
    Ratings:
    +639 / -0
    @jamil
    Please don't split replies, it will count as post farming.

    Patience is important, just be patient until they reply you.
    Good luck :D
     
    #17
  18. moek

    moek Honorary Poster Member

    Messages:
    425
    Ratings:
    +122 / -0
    xd sry if that looked leik a hate comment but Good luck I see that you can do some pretty awesome crap for gc ;) @jamil
     
    #18
  19. jamil

    jamil Journeyman Member

    Messages:
    30
    Ratings:
    +11 / -0
    @moek I guess there wil be haters..... but i will inform you in 10 days because.. GUESS WHAT... my android app is coming out.....oh what a surprise
     
    #19
    • Like Like x 1
  20. TanTG

    TanTG Quick Digit Member

    Messages:
    254
    Ratings:
    +61 / -0
    You have a bright future ahead @jamil . Good Luck dude ;)
     
    #20

Share This Page