Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (512)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Game Mechanics / Re: Dynamically load class on: 2013-05-31 13:04:02
Why the heck are player collision with block code in the block? Even as a simple implementation it would be put into the player class, but overall it would be better to put it in your collision manager.
I see your point. Collision detection, and stopping the player walking through the block is handled in the player class, its just block specific collision stuff, like pressure plates, and trip wires, where its handled in the block. In most blocks, this will be left blank, its just some special blocks that will be different. Similarly, to make blocks that aren't solid, a custom declaration and render would be needed. When i've finished, and got some new blocks type (and dynamite lol), i'll have to show you, then it'll all make sense (I hope)

Isn't this just using reflection?
It is indeed, I was just getting myself confused. Sorry about that one lol.

Offtopic, your class should start with an Upperclase letter.  Pointing
Indeed it should. I've borrowed and edited a friends class, and just havent got round to renaming it yet lol. I'll sort it before i finish.
2  Game Development / Game Mechanics / Re: Dynamically load class on: 2013-05-29 20:21:12
Ok, I'm faced with a slight difficulty now.

I've changed my mind a bit, and have all my class's in the main jar, but still want to call them dynamically. any ideas as to how?
3  Game Development / Game Mechanics / Re: Dynamically load class on: 2013-05-27 09:32:30
Thanks everyone for the quick (and supportive) replies Smiley

I'll have a look through all my options and pick the one that i think will work best for me

THANKYOU Cheesy

dan
4  Game Development / Game Mechanics / Dynamically load class on: 2013-05-26 20:36:08
Ok, first off, I'm new here, so sorry if this is in the wrong place Sad if it is, let me know, and i'll re-post it in the right place


now that's out the way, down to business.

I've just started out on a voxel-engine for making my future 3D games, so i'm not reinventing the wheel (or block as it were), every time i make a game (since most my games have been block based, or as i've come to lovingly call them, 3D tile based games, anyway).

What i really want to do, is allow for other people to add "blocks" into my game. so, I've decided that the best way to do that, is to dynamically load class's that match a standard template. And using a Map to hold them, so they can be "called"/identified by name. I'll also be using a loader, that reduces the risk of conflict, by renaming files that have the same name.

So, what i need to work out is how to dynamically load a class, and then be able to call its methods.

Heres an example of what all the class's WILL (moders permitting) will look like:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
public class block{
        /*there may or may not be variables stored here, for example, my TNT will have a count down variable stored here when its done*/
   
   public block(float x, float y, float z){
   /*used to set all parameters for the block, will only be passed the x,y,z values. by default, this is the bottom left front corner of the cube*/
   }

        public void interact(){
   /*this is what happens when the player interacts with the block.*/
   }
   
   public void jump(){
   /*this is what happens when the player is stood on top of the block (will probably remain empty)*/
   }
   
   public void bump(){
   /*if the player walks into the side of the block*/
   }
   
   public void update(){
   /*called every game loop, to make any changes, such as movement, or checking for [i]some[/i] collisions*/
   }
   
   public void render(){
   /*called EVERY loop, otherwise the block vanishes*/
   }


any hints on how to load and call these class's would be much appreciated.

if its relevant, all class's will be .class files.

Thanks in advance

DAN
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (50 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (36 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!