zbora23's Profile User Rating: -----

Reputation: 8 Worker
Group:
Active Members
Active Posts:
55 (0.04 per day)
Joined:
26-February 09
Profile Views:
2,736
Last Active:
User is offline Apr 25 2012 03:09 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   zbora23 has not set their status

Posts I've Made

  1. In Topic: Movement of 3D object maintaining its direction

    Posted 10 Nov 2011

    Hello,

    Thanks guys for all help.

    I have resolved my problem. What I needed was to maintain the angle e.g. Y-axis and if I press right or left button I add or simple extract from that value. And then if I want to move object in the direction it is facing I use cos() and sin() functions e.g. X-axis += -sinf(- Y-axis) will give me desired result on X-axis. Then I apply all rotation and translation to the object.


    Thanks ,
    David
  2. In Topic: My First Semester's Assignment: Game Project, Suggestion?

    Posted 30 Jun 2011

    radynaraya ,ButchDean is right, I will give you clue of what is your problem.

    You starting your loop from 0, think about your method of checking for the 10th day.
    Spend some time thinking and of course share your results with us. :)

    Dave.
  3. In Topic: Need an expert opinion on reimplementation of functions in DX10.

    Posted 29 Jun 2011

    hype261 Thanks a lot I really appreciate it. Do you know if the RenderStart and RenderStop functions are correct ? RenderStop doesn't have any code whatsoever, in the book on Direct3D 10 there is no mentioning about 'ending scene'.

    Thanks Again
    David
  4. In Topic: My First Semester's Assignment: Game Project, Suggestion?

    Posted 28 Jun 2011

    View Postradynaraya, on 27 June 2011 - 11:17 AM, said:

    #include<stdio.h>
    #include<stdlib.h>
    #include<time.h>
    #include<iostream>
    using namespace std;
    
    #define DICE 2
    #define MAX 10
    
    int pot,boat;
    
    int dice()
    {
    	int d[DICE], i, total=0;
    	srand((unsigned int)time(NULL));
    	for(i=0;i<DICE;++i)
    	{
    		d[i]=rand()%6+1;
    		total+=d[i];
    		printf("Dadu ke%d adalah %d\n",i+1,d[i]);
    	}
    	printf("\nYour dice is %d\n", total);
    	return 0;
    }
    
    int initialize()
    {
    	pot=10;
    	boat=1;
    	return 0;
    }
    
    int store(int temp,int fboat)
    {
    	int buy;
    	int answer;
    	while(1){
    	printf("\nWant to buy some pots or boats?\n");
    	printf("1.Pots\n");
    	printf("2.Boats\n");
    	cout<<"What you want to buy?";
    	cin>>buy;
    	switch(buy)
    	{
    	case 1:
    		temp=temp+1;
    		printf("Now your pot are %d\n",temp);
    		break;
    	case 2:
    		fboat=fboat+1;
    		printf("Now your boat are %d\n",fboat);
    		break;
    	}
    		cout<<"\nWant to buy again:";
    		cin>>answer;
    		if("answer"=="y"){
    			store(temp,fboat);
                          continue;
    		}
    		if("answer"=="n")
    		break;
    	}
    	return 0;
    }
    
    void main()
    {
    	printf("===Lost in Island===\n");
    	printf("Roll your dice!\n\n");
    	dice();
    	initialize();
    	printf("\nYou are given %d pot and %d fishing boat for start\n",pot,boat);
    	for(int i=0;i<MAX;i++)
    	{
    		printf("Day %d:\n",i+1);
    		store(pot,boat);
    	}
    	
    }
    
    


    I need help about my code, Mr.David or anyone. Why my program above give me loop forever ? i tried editing, moving, and not any of those solving my problem. someone can help?



    Hi There,

    I assume that you infinate loop is within the following function:
    int store(int temp,intfboat) { ... }
    


    if yes, the problem is following you had some mistakes with your code.

    here is corrected code with few comments from me :)
    int store(int temp,int fboat)
    {
    	int buy;
    	int answer;
    
    	// Addition of char variable
    	char answer2;
    
    	while(1){
    		printf("\nWant to buy some pots or boats?\n");
    		printf("1.Pots\n");
    		printf("2.Boats\n");
    		cout << "What you want to buy?";
    
    		cin>>buy;
    
    		switch(buy){
    
    				case 1:
    					temp = temp + 1;
    					printf( "Now your pot are %d\n" , temp );
    					break;
    				case 2:
    					fboat = fboat+1;
    					printf( "Now your boat are %d\n" , fboat );
    					break;
    		}
    
    		cout << "\nWant to buy again:";
    
    		//Use of answer2 below instead of answer
    		cin >> answer2;
    
    		//notice below answer2 is not in quotation marks "",and y or n are not in "" marks but in '' marks.
    		if(answer2 == 'y'){
    			store( temp , fboat );
    			continue;
    		}
    		if(answer2 == 'n') break;
    	}
    	return 0;
    }
    
    



    I have tested this code personally and it works.

    Hope this helps

    David
  5. In Topic: My First Semester's Assignment: Game Project, Suggestion?

    Posted 27 Jun 2011

    Hey There,

    First of all I'll tell you what I did. To gain more experience with programming I have created procedural game, implementing only basic features( placing pots in the harbour, at the open sea, selling/buying items ). After I had basic functionality I have started implementing more 'advanced' stuff e.g. different weather on different days etc. After this stage I have had working text-based game, also I got myself into 'C++ Thinking', which helps. So I had this basic game and I have started to introduce stuff like structures and classes, e.g. class called Player which held data i.e. amount of money, amount of assets etc. After Implementation of these features(classes and structures, and more object-oriented programming) you can start implementing additional features to the game like '2 players' or extended game play to '15 days'.

    For the basic game in terms of days I have packed everything into one big for loop that is being repeated 10 times. Later on I have added this into class. Then you can implement features like recognition of today's date.

    For the start keep it simple then add onto it. The game is really simple and in terms of C++ should not take more than 400 lines of code.

    Hope this helps.
    David.

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
3
Programming Languages:
C++

Contact Information

E-mail:
Private

Friends

Comments

zbora23 has no profile comments yet. Why not say hello?