Jump to content

Macecraft

Member
  • Content Count

    34
  • Joined

  • Last visited

  • Days Won

    1

Macecraft last won the day on January 5 2018

Macecraft had the most liked content!

1 Follower

About Macecraft

  • Birthday 08/08/1996

Profile Information

  • Gender
    Male
  • Interests
    Games Programming

Recent Profile Visitors

1,087 profile views
  1. Well, who knows.. I may do well... I may not
  2. Only one complaint, an ampersand is '&'
  3. Should really post a new one up, the dreadlocks look cooler than my mini afro from before!
  4. Macecraft

    Array Lists in Java

    And you can use what is effectively a foreach loop in Java
  5. Macecraft

    Java help

    It won't return anything to anywhere if the method isn't being called.
  6. Isn't this post in the wrong place then?
  7. Macecraft

    Java Requests

    There's numerous websites for plugin lessons
  8. http://www.youtube.com/watch?v=Y4zaofnVhps
  9. Macecraft

    Metal

    http://www.youtube.com/watch?v=9n99wmO1skE That's my good ****.
  10. Macecraft

    Metal

    Industrial, that's pretty good. I think my favourites are thrash, black & melodic death metal and deathcore.
  11. Macecraft

    Metal

    So I've not seen any topics on this, may have missed them, but is anyone a fan of standard metal or even into the extreme sides of metal?
  12. It's time to learn some Slick2D! This time we're aiming to just have a window which says "Hello World" on it! Please note the terms - AppGameContainer, BasicGameState, StateBasedGame, GameContainer & delta will be explained in the next tutorial Let's start with some classes! Make a new class called 'Display', I'd suggest putting it into a package mine in a package called: com.mace.teaching; Now make another class and call this 'State1', I'd also suggest putting this into a package but with an extra subfolder com.mace.teaching.states; is mine. Now let's run through the code we use in 'Display' package com.mace.teaching; //Below we import the required Slick classes import org.newdawn.slick.AppGameContainer; import org.newdawn.slick.GameContainer; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.StateBasedGame; //Importing our State1 class for use in Display import com.mace.teaching.states.State1; //Here we inherit all the things we need from Slick's 'StateBasedGame' class public class Display extends StateBasedGame{ //Variables we'll use, g_name is the window title //Width = window width //Height is the window height static String g_name = "Slick2D"; static int WIDTH = 400; static int HEIGHT = 400; //Our constructor takes a string as a requirement public Display(String name) { super(name); this.addState(new State1()); //Here we add our 'State1' as a game state to be used //Don't worry if Eclipse readlines, we'll add the functionality for it to work soon! } //An inherited method from the StateBasedGame class @Override public void initStatesList(GameContainer gc) throws SlickException { // TODO Auto-generated method stub this.enterState(0); //Here we specify that we want state1 to be the one we enter first } public static void main(String args[]){ //Our AppGameContainer will create the GUI window we see AppGameContainer agc; try{ //Here we pass in this class as the StateBasedGame agc = new AppGameContainer(new Display(g_name)); //Setting the display mode, requirements for this function are - //agc.setDisplayMode(int width, int height, boolean fullscrean); agc.setDisplayMode(WIDTH, HEIGHT, false); //Here we tell it to create the window agc.start(); }catch(SlickException e){ //Just in case we can't create the window, we catch the exception e.printStackTrace(); } } } Here's the code for the class 'State1' package com.mace.teaching.states; //Imports again! import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.BasicGameState; import org.newdawn.slick.state.StateBasedGame; //Inheriting the methods from BasicGameState public class State1 extends BasicGameState { //The text we will draw to our new window String hi = "Hello World"; @Override public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { //In Slick this method is called once to initialize data and that's it //Because it's called once it throws a SlickException for when we get to //resource loading } @Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { // This is the method which will render data to the screen //It gets called a number of times per second so it can constantly update the position //of objects on the screen //The instruction below tells the graphics tool to take a string variable //And draw text to the location of 150,150 //The generic requirements for rendering are - g.RandomFunc(Object obj, int x, int y); g.drawString(hi, 150 , 150); } @Override public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { // This is the update method where the bulk of the code will go // This is where things like collision detection, key presses & general game logic are //handled. It gets called in the game loop cycle as often as render. //The calling per cycle will become important when we use delta } @Override public int getID() { // This tells our 'Display' class what number this state is return 0; } } If all is well, when you try run this you should see - If not, paste any console messages and I'll you why. The full details of what we've done will be explained in the next tutorial 'Tut 1 - Code walk through!'

About us

MMO-Society is the Forum former known as Lordcraft, MMO-Society offers various of Resources to help you evolve your knowledge within Emulation, In the process we make sure to form a strong community bond in-between each other and thus we are proud to can admit that MMO-Society is possibly the friendliest Community Forum to currently exist.

Useful Quick-Links

×
×
  • Create New...