Search Results

Search found 197 results on 8 pages for 'siu ching pong asuka kenji'.

Page 1/8 | 1 2 3 4 5 6 7 8  | Next Page >

  • Not able to compile dbus-ping-pong

    - by Mahipal
    I have downloaded files from http://cgit.collabora.com/git/user/alban/dbus-ping-pong.git/tree/ I am trying to compile it using the command gcc pkg-config --libs --cflags dbus-1 dbus-glib-1-2 glib-2.0 -o dbus-ping-pong dbus-ping-pong.c However, I get errors: /tmp/ccmJkxXb.o: In function g_once_init_enter: dbus-ping-pong.c:(.text+0x22): undefined reference to g_once_init_enter_impl /tmp/ccmJkxXb.o: In function dbus_glib_marshal_echo_srv__BOOLEAN__STRING_POINTER_POINTER: dbus-ping-pong.c:(.text+0x52): undefined reference to g_return_if_fail_warning dbus-ping-pong.c:(.text+0x79): undefined reference to g_return_if_fail_warning dbus-ping-pong.c:(.text+0x9d): undefined reference to g_value_peek_pointer dbus-ping-pong.c:(.text+0xac): undefined reference to g_value_peek_pointer dbus-ping-pong.c:(.text+0x109): undefined reference to g_value_set_boolean /tmp/ccmJkxXb.o: In function echo_ping_class_intern_init: dbus-ping-pong.c:(.text+0x122): undefined reference to g_type_class_peek_parent /tmp/ccmJkxXb.o: In function echo_ping_get_type: dbus-ping-pong.c:(.text+0x162): undefined reference to g_intern_static_string dbus-ping-pong.c:(.text+0x192): undefined reference to g_type_register_static_simple dbus-ping-pong.c:(.text+0x1a8): undefined reference to g_once_init_leave /tmp/ccmJkxXb.o: In function echo_ping_class_init: dbus-ping-pong.c:(.text+0x1cd): undefined reference to g_type_class_add_private dbus-ping-pong.c:(.text+0x1e2): undefined reference to dbus_g_object_type_install_info /tmp/ccmJkxXb.o: In function echo_ping_init: dbus-ping-pong.c:(.text+0x1fe): undefined reference to g_type_instance_get_private /tmp/ccmJkxXb.o: In function echo_ping: dbus-ping-pong.c:(.text+0x21d): undefined reference to g_strdup /tmp/ccmJkxXb.o: In function client: dbus-ping-pong.c:(.text+0x265): undefined reference to dbus_g_proxy_new_for_name dbus-ping-pong.c:(.text+0x2c3): undefined reference to dbus_g_proxy_call dbus-ping-pong.c:(.text+0x2d1): undefined reference to dbus_g_error_quark dbus-ping-pong.c:(.text+0x2f1): undefined reference to dbus_g_error_get_name dbus-ping-pong.c:(.text+0x305): undefined reference to g_printerr dbus-ping-pong.c:(.text+0x31d): undefined reference to g_printerr dbus-ping-pong.c:(.text+0x328): undefined reference to g_error_free dbus-ping-pong.c:(.text+0x358): undefined reference to g_print dbus-ping-pong.c:(.text+0x363): undefined reference to g_free /tmp/ccmJkxXb.o: In function main: dbus-ping-pong.c:(.text+0x38f): undefined reference to g_type_init dbus-ping-pong.c:(.text+0x3a3): undefined reference to dbus_g_bus_get dbus-ping-pong.c:(.text+0x3c7): undefined reference to g_object_new dbus-ping-pong.c:(.text+0x3df): undefined reference to g_type_check_instance_cast dbus-ping-pong.c:(.text+0x3f9): undefined reference to dbus_g_connection_register_g_object dbus-ping-pong.c:(.text+0x406): undefined reference to dbus_g_connection_get_connection dbus-ping-pong.c:(.text+0x426): undefined reference to dbus_bus_request_name dbus-ping-pong.c:(.text+0x43a): undefined reference to g_main_loop_new dbus-ping-pong.c:(.text+0x44a): undefined reference to g_main_loop_run How do I resolve this issue ?

    Read the article

  • Make Pong on android using OpenGL-ES

    - by brainydexter
    I am trying to make a simple pong game using opengl-es. I have checked out some of the tutorials/samples, but most of them are pre-dated to 2009. I am familiar with game programming, and consider pong to be the hello-world! Right now, I intend to make it using their supplied SDK (2.3), but eventually I want to make it in NDK, so I can port my other work to android. Would anyone have a good reference for a starting point ? Thanks

    Read the article

  • Changing balls direction in Pong

    - by hustlerinc
    I'm making a Pong game to get started with game-developement but I've run into a problem that i can't figure out. When trying to change the balls direction it doesn't change. This is the relevant code: function moveBall(){ this.speed = 2.5; this.direction = 2; if(this.direction == 1){ ball.X +=this.speed; } else if(this.direction == 2){ ball.X -=this.speed; } } function collision(){ if(ball.X == 500){ moveBall.direction = 2; } if(ball.X == 300){ moveBall.direction = 1; } } Why doesn't it work? I've tried many different ways, and none of them seem to work. The moveBall.direction changes though, since it alerts the new direction once it reaches the defined ball.X position. If someone could help me I would deeply appreciate it. I've included a JSFiddle link. http://jsfiddle.net/hustlerinc/y4wp3/

    Read the article

  • High CPU usage on Pong clone

    - by max
    I just made my first game, a clone of Pong, using OpenGL and C++. But its using ~50% of the CPU, which I guess is very high for a game like this. How can I improve that? Can you please look up my code and tell me what all things I am doing wrong? Any feedback is welcome. http://pastebin.com/L5zE3axh Also it would be extremely helpful if you give some general points on how to develop games in OpenGL efficiently.. Thanks in advance!

    Read the article

  • Html 5 ping pong game side collision problem

    - by Gurjit
    I am making a simple ping pong game where I am facing a side collision problem means when the ball collides with the either side of the paddle . Although I have written code for making it works but something is failing....I want plz someone to give suggestions and tell how to avoid it. Means while trying to hit the ball with side face of the paddle poses a problem.!! Here is the main part of the code causing problem function checkCollision(){ ///// This is collision detection for the upper part ///// if( cy + radius >= paddleTop && cx + radius > paddleLeft && cy + radius >= paddleTop + 5 && cx - radius <= paddleLeft + paddleWidth ) { dy = -dy; ++hits; /// On collision we are increasing the Score playSound(); } else if( cy + radius >= paddleTop && cy + radius <= paddleTop + paddleHeight && cx + radius >= paddleLeft && cy - radius <= paddleLeft - (radius + 1) ) { dx = -dx; } } here is working fiddle for it :- http://jsfiddle.net/gurjitmehta/orzpzf69/

    Read the article

  • Simple collision detection for pong

    - by Dave Voyles
    I'm making a simple pong game, and things are great so far, but I have an odd bug which causes my ball (well, it's a box really) to get stuck on occasion when detecting collision against the ceiling or floor. It looks as though it is trying to update too frequently to get out of the collision check. Basically the box slides against the top or bottom of the screen from one paddle to the other, and quickly bounces on and off the wall while doing so, but only bounces a few pixels from the wall. What can I do to avoid this problem? It seems to occur at random. Below is my collision detection for the wall, as well as my update method for the ball. public void UpdatePosition() { size.X = (int)position.X; size.Y = (int)position.Y; position.X += speed * (float)Math.Cos(direction); position.Y += speed * (float)Math.Sin(direction); CheckWallHit(); } // Checks for collision with the ceiling or floor. // 2*Math.pi = 360 degrees // TODO: Change collision so that ball bounces from wall after getting caught private void CheckWallHit() { while (direction > 2 * Math.PI) { direction -= 2 * Math.PI; } while (direction < 0) { direction += 2 * Math.PI; } if (position.Y <= 0 || (position.Y > resetPos.Y * 2 - size.Height)) { direction = 2 * Math.PI - direction; } }

    Read the article

  • Pong Collision Help in C# w/ XNA

    - by Ramses Brown
    Edit: My goal is to have it function like this: Ball hits 1st Quarter = rebounds higher (aka Y++) Ball hits 2nd Quarter = rebounds higher (using random value) Ball hits 3rd Quarter = rebounds lower (using random value) Ball hits 4th Quarter = rebounds lower (aka Y--) I'm currently using Rectangle Collision for my collision detection, and it's worked. Now I wish to expand it. Instead of it simply detecting whether or not the paddle/ball intersect, I want to make it so that it can determine what section of the paddle gets hit. I wanted it in 4 parts, with each having a different reaction to impact. My first thought is to base it on the Ball's Y position compared to the Paddle's Y position. But since I want it in 4 parts, I don't know how to do that. So it's essentially be if (ball.Y > Paddle.Y) { PaddleSection1 == true; } Except modified so that instead of being top half/bottom half, it's 1st Quarter, etc.

    Read the article

  • Game works on netbeans but not outside netbeans in jar file?

    - by Michael Haywood
    I am creating a basic game of 'Pong'. I have finished the game apart from a few glitches I need to remove. The game runs perfectly in netbeans but if I create a jar file errors come up causing it to not work. I am quite new to java but I believe it is something to do with my code looking for the images but the images have not been loaded up yet. Here is the error. How can I get this to work outside of netbeans in a jar file? C:\Users\michael>java -jar "C:\Users\michael\Documents\NetBeansProjects\Pong\dis t\Pong.jar" Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(Unknown Source) at pong.BallMainMenu.<init>(BallMainMenu.java:19) at pong.Board.gameInit(Board.java:93) at pong.Board.addNotify(Board.java:86) at java.awt.Container.addNotify(Unknown Source) at javax.swing.JComponent.addNotify(Unknown Source) at java.awt.Container.addNotify(Unknown Source) at javax.swing.JComponent.addNotify(Unknown Source) at java.awt.Container.addNotify(Unknown Source) at javax.swing.JComponent.addNotify(Unknown Source) at javax.swing.JRootPane.addNotify(Unknown Source) at java.awt.Container.addNotify(Unknown Source) at java.awt.Window.addNotify(Unknown Source) at java.awt.Frame.addNotify(Unknown Source) at java.awt.Window.show(Unknown Source) at java.awt.Component.show(Unknown Source) at java.awt.Component.setVisible(Unknown Source) at java.awt.Window.setVisible(Unknown Source) at pong.Pong.<init>(Pong.java:16) at pong.Pong.main(Pong.java:23)

    Read the article

  • Pong: How does the paddle know where the ball will hit?

    - by Roflcoptr
    After implementing Pacman and Snake I'm implementing the next very very classic game: Pong. The implementation is really simple, but I just have one little problem remaining. When one of the paddle (I'm not sure if it is called paddle) is controlled by the computer, I have trouble to position it at the correct position. The ball has a current position, a speed (which for now is constant) and a direction angle. So I could calculate the position where it will hit the side of the computer controlled paddle. And so Icould position the paddle right there. But however in the real game, there is a probability that the computer's paddle will miss the ball. How can I implement this probability? If I only use a probability of lets say 0.5 that the computer's paddle will hit the ball, the problem is solved, but I think it isn't that simple. From the original game I think the probability depends on the distance between the current paddle position and the position the ball will hit the border. Does anybody have any hints how exactly this is calculated?

    Read the article

  • Socket ping-pong performance

    - by Kamil_H
    I have written two simple programs (tried it in C++ and C#). This is pseudo code: -------- Client --------------- for(int i = 0; i < 200.000; i++) { socket_send("ping") socket_receive(buff) } --------- Server ------------- while(1) { socket_receive(buff) socket_send("pong") } I tried it on Windows. Execution time of client is about 45 seconds. Can somebody explain me why this takes so long? I understand that if there were real network connection between client and server the time of one 'ping-pong' would be: generate_ping + send_via_network + generate_pong + send_via_network but here everything is done in 'local' mode. Is there any way to make this inter process ping-pong faster using network sockets (I'm not asking about shared memory for example :) )

    Read the article

  • Build SUM based daily record

    - by ximarin
    I have a problem building an aggregate function. Here's my problem: I have a table like this id action day isSum difference 1 ping 2012-01-01 1 500 (this is the sum of the differences from last year) 2 ping 2012-01-01 0 -2 3 ping 2012-01-02 0 1 4 ping 2012-01-03 0 -4 5 ping 2012-01-04 0 -2 6 ping 2012-01-05 0 3 7 ping 2012-01-06 0 2 8 ping 2012-01-01 1 0 (this is the sum of the differences from last year, now for pong) 9 pong 2012-01-01 0 -5 10 pong 2012-01-02 0 2 11 pong 2012-01-03 0 -2 12 pong 2012-01-04 0 -8 13 pong 2012-01-05 0 3 14 pong 2012-01-06 0 4 I now need to select the action, day and the summarized difference since 01-01 for every day, so that my result looks like this action day total ping 2012-01-01 498 ping 2012-01-02 499 ping 2012-01-03 495 ping 2012-01-04 493 ping 2012-01-05 496 ping 2012-01-06 498 pong 2012-01-01 - 5 pong 2012-01-02 - 3 pong 2012-01-03 - 5 pong 2012-01-04 -13 pong 2012-01-05 -10 pong 2012-01-06 - 6 How can I do this? there a are a lot of datasets (~1 million), so the query needs to be pretty cheap. I don't know how the use sum to get daily sums for daily records depending on the action-column.

    Read the article

  • iPhone Pong Advanced Deflection Angle

    - by CherryBun
    Hi, I am currently developing a simple Pong game for the iPhone. Currently using CGRectIntersectsRect for the collision detection and as for the deflection of the ball when it hits the paddle, I just multiply the ball velocity with -1 (therefore reversing the direction of the ball). What I am trying to do is to make it so that when the ball hits the paddle, it checks whether how far is the ball from the center of the paddle, and increases the deflection angle the further the ball is away from the center of the paddle. (E.g. In this case, the ball will be deflected back at 90 degrees no matter where it came from, as long as it hits the center of the paddle) How am I suppose to do that? Any help would be greatly appreciated. Thank you.

    Read the article

  • Single player 'pong' game

    - by Jam
    I am just starting out learning pygame and livewires, and I'm trying to make a single-player pong game, where you just hit the ball, and it bounces around until it passes your paddle (located on the left side of the screen and controlled by the mouse), which makes you lose. I have the basic code, but the ball doesn't stay on the screen, it just flickers and doesn't remain constant. Also, the paddle does not move with the mouse. I'm sure I'm missing something simple, but I just can't figure it out. Help please! Here's what I have: from livewires import games import random games.init(screen_width=640, screen_height=480, fps=50) class Paddle(games.Sprite): image=games.load_image("paddle.bmp") def __init__(self, x=10): super(Paddle, self).__init__(image=Paddle.image, y=games.mouse.y, left=10) self.score=games.Text(value=0, size=25, top=5, right=games.screen.width - 10) games.screen.add(self.score) def update(self): self.y=games.mouse.y if self.top<0: self.top=0 if self.bottom>games.screen.height: self.bottom=games.screen.height self.check_collide() def check_collide(self): for ball in self.overlapping_sprites: self.score.value+=1 ball.handle_collide() class Ball(games.Sprite): image=games.load_image("ball.bmp") speed=5 def __init__(self, x=90, y=90): super(Ball, self).__init__(image=Ball.image, x=x, y=y, dx=Ball.speed, dy=Ball.speed) def update(self): if self.right>games.screen.width: self.dx=-self.dx if self.bottom>games.screen.height or self.top<0: self.dy=-self.dy if self.left<0: self.end_game() self.destroy() def handle_collide(self): self.dx=-self.dx def end_game(self): end_message=games.Message(value="Game Over", size=90, x=games.screen.width/2, y=games.screen.height/2, lifetime=250, after_death=games.screen.quit) games.screen.add(end_message) def main(): background_image=games.load_image("background.bmp", transparent=False) games.screen.background=background_image paddle_image=games.load_image("paddle.bmp") the_paddle=games.Sprite(image=paddle_image, x=10, y=games.mouse.y) games.screen.add(the_paddle) ball_image=games.load_image("ball.bmp") the_ball=games.Sprite(image=ball_image, x=630, y=200, dx=2, dy=2) games.screen.add(the_ball) games.mouse.is_visible=False games.screen.event_grab=True games.screen.mainloop() main()

    Read the article

  • Single-player pong game

    - by Jam
    I am just starting out learning pygame and livewires, and I'm trying to make a single-player pong game, where you just hit the ball, and it bounces around until it passes your paddle (located on the left side of the screen and controlled by the mouse), which makes you lose. However, I keep getting the error: "Cannot have more than on Screen object", which I can find no references to online really, and I can't make sense of it. I want to eventually make the game more complicated, but I need to make it work first. Help please! Here's the code so far: from livewires import games games.init(screen_width=640, screen_height=480, fps=50) class Paddle(games.Sprite): image=games.load_image("paddle.bmp") def __init__(self): super(Paddle, self).__init__(image=Paddle.image, y=games.mouse.y, left=0) self.score=games.Text(value=0, size=25, top=5, right=games.screen.width-10) games.screen.add(self.score) def update(self): self.y=games.mouse.y self.check_collide() def check_collide(self): for ball in self.overlapping_sprites: self.score.value+=1 self.score.right=games.screen.width-10 ball.handle_collide() class Ball(games.Sprite): image=games.load_image("ball.bmp") speed=1 def __init__(self, x, y=90): super(Ball, self).__init__(image=Ball.image, x=x, y=y, dx=Ball.speed, dy=Ball.speed) def update(self): if self.left<0: self.end_game() self.destroy() def handle_collide(self): if self.right>games.screen.width: self.dx=-self.dx if self.bottom>games.screen.height or self.top<0: self.dy=-self.dy def ball_destroy(self): self.destroy() def main(): background_image=games.load_image("background.bmp", transparent=False) games.screen.background=background_image the_ball=Ball() games.screen.add(the_ball) the_paddle=Paddle() games.screen.add(the_paddle) games.mouse.is_visible=False games.screen.event_grab=True games.screen.mainloop() main()

    Read the article

  • Why is Apple System Image Utility so slow?

    - by Jon Rhoades
    I'm using Apple System Image Utility (SIU) on Snow Leopard 10.6.2 and I am rather disturbed it takes over Three hours to make a Netrestore or Netboot image. I'm using as the donor machine a brand new iMac and as the imaging machine a brand new iMac connected using target disk mode & Firewire 800. The hard drive size and subsequent image is about 8GB. To restore the image over the network takes about 4 minutes. Given that Norton Ghost will take an image in about 5 minutes (or less on newer machines) over USB2, why is the Mac over an order of magnitude slower?

    Read the article

  • How to synchronize the ball in a network pong game?

    - by Thaars
    I’m developing a multiplayer network pong game, my first game ever. The current state is, I’ve running the physic engine with the same configurations on the server and the clients. The own paddle movement is predicted and get just confirmed by the authoritative server. Is a difference detected between them, I correct the position at the client by interpolation. The opponent paddle is also interpolated 200ms to 100ms in the past, because the server is broadcasting snapshots every 100ms to each client. So far it works very well, but now I have to simulate the ball and have a problem to understanding the procedure. I’ve read Valve’s (and many other) articles about fast-paced multiplayer several times and understood their approach. Maybe I can compare my ball with their bullets, but their advantage is, the bullets are not visible. When I have to display the ball, and see my paddle in the present, the opponent in the past and the server is somewhere between it, how can I synchronize the ball over all instances and ensure, that it got ever hit by the paddle even if the paddle is fast moving? Currently my ball’s position is simply set by a server update, so it can happen, that the ball bounces back, even if the paddle is some pixel away (because of a delayed server position). Until now I’ve got no synced clock over all instances. I’m sending a client step index with each update to the server. If the server did his job, he sends the snapshot with the last step index of each client back to the clients. Now I’m looking for the stored position at the returned step index and compare them. Do I need a common clock to sync the ball? EDIT: I've tried to sync a common clock for the server and all clients with a timestamp. But I think it's better to use an own stepping instead of a timestamp (so I don't need to calculate with the ping and so on - and the timestamp will never be exact). The physics are running 60 times per second and now I use this for keeping them synchronized. Is that a good way? When the ball gets calculated by each client, the angle after bouncing can differ because of the different position of the paddles (the opponent is 200ms in the past). When the server is sending his ball position, velocity and angle (because he knows the position of each paddle and is authoritative), the ball could be in a very different position because of the different angles after bouncing (because the clients receive the server data after 100ms). How is it possible to interpolate such a huge difference? I posted this question some days ago at stackoverflow, but got no answer yet. Maybe this is the better place for this question.

    Read the article

  • Flickering when accessing texture by offset

    - by TravisG
    I have this simple compute shader that basically just takes the input from one image and writes it to another. Both images are 128/128/128 in size and glDispatchCompute is called with (128/8,128/8,128/8). The source images are cleared to 0 before this compute shader is executed, so no undefined values should be floating around in there. (I have the appropriate memory barrier on the C++ side set before the 3D texture is accessed). This version works fine: #version 430 layout (location = 0, rgba16f) uniform image3D ping; layout (location = 1, rgba16f) uniform image3D pong; layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in; void main() { ivec3 sampleCoord = gl_GlobalInvocationID.xyz; imageStore(pong, imageLoad(ping,sampleCoord)); } Reading values from pong shows that it's just a copy, as intended. However, when I load data from ping with an offset: #version 430 layout (location = 0, rgba16f) uniform image3D ping; layout (location = 1, rgba16f) uniform image3D pong; layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in; void main() { ivec3 sampleCoord = gl_GlobalInvocationID.xyz; imageStore(pong, imageLoad(ping,sampleCoord+ivec3(1,0,0))); } The data that is written to pong seems to depend on the order of execution of the threads within the work groups, which makes no sense to me. When reading from the pong texture, visible flickering occurs in some spots on the texture. What am I doing wrong here?

    Read the article

  • How do I create a downscaled copy of an FBO in OpenGL?

    - by Jasper Bekkers
    Hi, In order to speed up some post-processing shaders I'm using, I need to perform these operations on a framebuffer that is smaller in size than the actual window (about 1/4th or more). Most of the effects I want to optimize are simple blurring operations that could be replaced (for a large part) by smaller kernel and bilinear filtering. Thus, I need to create a copy of the current FBO into another one. However, I couldn't find anything, that works, on how to do this. I've tried using glBlitframebufferEXT and rendering a fullscreen quad into the other framebuffer, but both paths result in a black texture as output. How do I go about solving this problem?

    Read the article

  • Atari sort des versions Web en HTML5 de ses titres d'arcades cultes avec l'équipe d'Internet Explorer 10 : Pong, Lunar Lander, etc.

    Les jeux d'arcade d'Atari s'ouvrent au Web avec HTML5 et Internet Explorer 10 grâce au partenariat de l'éditeur avec Microsoft A moins de deux mois de la sortie de la version finale d'Internet Explorer 10, Microsoft saisit une fois de plus l'occasion de mettre en avant les nouveautés du navigateur, surtout en ce qui concerne le support du HTML5 et la navigation tactile. Après des travaux pour le port de Pulse, le service d'actualités qui rassemble l'essentiel de la presse écrite, des blogs et sites d'actualités au travers d'une large sélection de f...

    Read the article

  • What is causing this behavior with the movement of Pong Ball in 2D? [closed]

    - by thegermanpole
    //edit after running it through the debugger it turned out i had the display function set to x,x...TIL how to use a debugger I've been trying to teach myself C++ SDL with the lazyfoo tutorial and seem to have run into a roadblock. The code below is the movement function of my Dot class, which controls the ball. The ball seems to ignore yvel and moves with xvel to the bottom right. The code should be pretty readable, the rest of the relevant facts are: All variables are names Constants are in caps dotrad is the radius of my dot yvel and xvel are set to 5 in the constructor The dot is created at x and y equal to 100 When I comment out the x movement block it doesn't move, but if i comment out the y movement block, it keeps on going down to the right. void Dot::move() { if(((y+yvel+dotrad) <= SCREEN_HEIGHT) && (0 <= (y-dotrad+yvel))) { y+=yvel; } else { yvel = -1*yvel; } if(((x+xvel+dotrad) <= SCREEN_WIDTH) && (0 <= (x-dotrad+xvel))) { x +=xvel; } else { xvel = -1*xvel; } }

    Read the article

  • XNA - Pong Clone - Reflecting ball when it hits a wall?

    - by toleero
    Hi guys, I'm trying to make the ball bounce off of the top and bottom 'Walls' of my UI when creating a 2D Pong Clone. This is my Game.cs public void CheckBallPosition() { if (ball.Position.Y == 0 || ball.Position.Y >= graphics.PreferredBackBufferHeight) ball.Move(true); else ball.Move(false); if (ball.Position.X < 0 || ball.Position.X >= graphics.PreferredBackBufferWidth) ball.Reset(); } At the moment I'm using this in my Ball.cs public void Move(bool IsCollidingWithWall) { if (IsCollidingWithWall) { Vector2 normal = new Vector2(0, 1); Direction = Vector2.Reflect(Direction,normal); this.Position += Direction; Console.WriteLine("WALL COLLISION"); } else this.Position += Direction; } It works, but I'm using a manually typed Normal and I want to know how to calculate the normal of the top and bottom parts of the screen?

    Read the article

  • Should actors in a game be responsible for drawing themselves?

    - by alex
    I am very new to game development, but not to programming. I am (again) playing around with a Pong type game using JavaScript's canvas element. I have created a Paddle object which has the following properties... width height x y colour I also have a Pong object which has properties such as... width height backgroundColour draw(). The draw() method currently is resetting the canvas and that is where a question came up. Should the Paddle object have a draw() method responsible for its drawing, or should the draw() of the Pong object be responsible for drawing its actors (I assume that is the correct term, please correct me if I'm incorrect). I figured that it would be advantagous for the Paddle to draw itself, as I instantiate two objects, Player and Enemy. If it were not in the Pong's draw(), I'd need to write similar code twice. What is the best practice here? Thanks.

    Read the article

  • Possible to pass pygame data to memory map block?

    - by toozie21
    I am building a matrix out of addressable pixels and it will be run by a Pi (over the ethernet bus). The matrix will be 75 pixels wide and 20 pixels tall. As a side project, I thought it would be neat to run pong on it. I've seen some python based pong tutorials for Pi, but the problem is that they want to pass the data out to a screen via pygame.display function. I have access to pass pixel information using a memory map block, so is there anyway to do that with pygame instead of passing it out the video port? In case anyone is curious, this was the pong tutorial I was looking at: Pong Tutorial

    Read the article

  • The best cross platform (portable) arbitrary precision math library

    - by Siu Ching Pong - Asuka Kenji
    Dear ninjas / hackers / wizards, I'm looking for a good arbitrary precision math library in C or C++. Could you please give me some advices / suggestions? The primary requirements: It MUST handle arbitrarily big integers (my primary interest is on integers). In case that you don't know what the word arbitrarily big means, imagine something like 100000! (the factorial of 100000). The precision MUST NOT NEED to be specified during library initialization / object creation. The precision should ONLY be constrained by the available resources of the system. It SHOULD utilize the full power of the platform, and should handle "small" numbers natively. That means on a 64-bit platform, calculating 2^33 + 2^32 should use the available 64-bit CPU instructions. The library SHOULD NOT calculate this in the same way as it does with 2^66 + 2^65 on the same platform. It MUST handle addition (+), subtraction (-), multiplication (*), integer division (/), remainder (%), power (**), increment (++), decrement (--), gcd(), factorial(), and other common integer arithmetic calculations efficiently. Ability to handle functions like sqrt() (square root), log() (logarithm) that do not produce integer results is a plus. Ability to handle symbolic computations is even better. Here are what I found so far: Java's BigInteger and BigDecimal class: I have been using these so far. I have read the source code, but I don't understand the math underneath. It may be based on theories / algorithms that I have never learnt. The built-in integer type or in core libraries of bc / Python / Ruby / Haskell / Lisp / Erlang / OCaml / PHP / some other languages: I have ever used some of these, but I have no idea on which library they are using, or which kind of implementation they are using. What I have already known: Using a char as a decimal digit, and a char* as a decimal string and do calculations on the digits using a for-loop. Using an int (or a long int, or a long long) as a basic "unit" and an array of it as an arbitrary long integer, and do calculations on the elements using a for-loop. Booth's multiplication algorithm What I don't know: Printing the binary array mentioned above in decimal without using naive methods. Example of a naive method: (1) add the bits from the lowest to the highest: 1, 2, 4, 8, 16, 32, ... (2) use a char* string mentioned above to store the intermediate decimal results). What I appreciate: Good comparisons on GMP, MPFR, decNumber (or other libraries that are good in your opinion). Good suggestions on books / articles that I should read. For example, an illustration with figures on how a un-naive arbitrarily long binary to decimal conversion algorithm works is good. Any help. Please DO NOT answer this question if: you think using a double (or a long double, or a long long double) can solve this problem easily. If you do think so, it means that you don't understand the issue under discussion. you have no experience on arbitrary precision mathematics. Thank you in advance! Asuka Kenji

    Read the article

  • Problem with develop of XML Schema based on an existent XML

    - by farhad
    Hello! I have a problem with the validation of this piece of XML: <?xml version="1.0" encoding="UTF-8"?> <i-ching xmlns="http://www.oracolo.it/i-ching"> <predizione> <esagramma nome="Pace"> <trigramma> <yang/><yang/><yang/> </trigramma> <trigramma> <yin/><yin/><yin/> </trigramma> </esagramma> <significato>Questa combinazione preannuncia <enfasi>boh</enfasi>, e forse anche <enfasi>mah, chissa</enfasi>.</significato> </predizione> <predizione> <esagramma nome="Ritorno"> <trigramma> <yang/><yin/> <yin/> </trigramma> <trigramma> <yin/><yin/><yin/> </trigramma> </esagramma> <significato>Si prevede con certezza <enfasi>qualcosa</enfasi>, <enfasi>ma anche <enfasi>no</enfasi></enfasi>.</significato> </predizione> </i-ching> This XML Schema was developed with Russian Dolls technique: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.oracolo.it/i-ching" targetNamespace="http://www.oracolo.it/i-ching" > <xsd:element name="i-ching"> <xsd:complexType> <xsd:sequence> <xsd:element name="predizione" minOccurs="0" maxOccurs="64"> <xsd:complexType> <xsd:sequence> <xsd:element name="esagramma"> <xsd:complexType> <!-- vi sono 2 trigrammi --> <xsd:sequence> <xsd:element name="trigramma" minOccurs="2" maxOccurs="2"> <xsd:complexType> <xsd:sequence minOccurs="3" maxOccurs="3"> <xsd:choice> <xsd:element name="yang"/> <xsd:element name="yin"/> </xsd:choice> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> <xsd:attribute name="nome" type="xsd:string"/> </xsd:complexType> </xsd:element> <!-- significato: context model misto --> <xsd:element name="significato"> <xsd:complexType mixed="true"> <xsd:sequence> <xsd:element name="enfasi" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> For exercise I have to develop an XML Schema to validate the previous XML. The problem is that oxygen says me this: cvc-complex-type.2.4.a: Invalid content was found starting with element 'predizione'. One of '{predizione}' is expected. Start location: 3:6 End location: 3:16 URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type why? is it something wrong with my xml schema? thank you very much

    Read the article

1 2 3 4 5 6 7 8  | Next Page >