• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Subliminalman

Members
  • Content count

    25
  • Joined

  • Last visited

Community Reputation

109 Neutral

About Subliminalman

  • Rank
    Member

Personal Information

  1.   I guess it's slightly both. We're preparing a demo to show off but I also want to get players impressions of how the game generally feels.  So perhaps alpha would be a better term for this.       Any tips on what to google search? I have listened to some GDC talks before on the subject but never have found any questionnaires specifically for games with the exception of club nintendo.
  2. So the game is a platformer for mobile that is using a non virtual joypad control input and it will be coming out for both iOS and Android. It's has the general theming of a Mario game, so not dark like a Castlevania title.   The only other person that is working on the title is my girlfriend and I believe most of the people that are coming are going to be game  devs from my local IGDA chapter. We're also doing this at a local café so we may not be able to get webcam stuff going.   Also how many questions might be too many? We have them going through three levels that are approximately a minute and a half each  so I don't want to overload them.
  3. I am doing a beta test for the game I am currently working on with friends and family as well as various people within my game dev community. I wanted to get impressions from them on how they felt about the game. I'm already getting metric data within the game but I want their opinions as well. I am using a Google Form for the survey so I have access to web inputs such as radio buttons and check boxes.       So I'm wondering what would be some great questions to ask?   Edit::   So I started writing some down, here's what I have so far.   1.How do the controls feel? 2. Are the controls easy/intuitive? (1 - 5 scale) 3.Why did you pick the character you played as? 4.How difficult was Level (1, 2, 3)?(1- 5 scale) 5.How fun was Level (1, 2, 3)?(1 - 5 scale) 6.What did you enjoy about the game? 7.What did you not enjoy about the game?
  4. Hello! I wanted to show you a fun little game I am currently making and would like to hear feedback from you! It is a Tactical RPG of Basketball! It is currently in a board game format because I wanted to get the feel of its core game play before I write a single line of code. What I currently have now is a very basic game and will improve on it later based upon feedback. [u]Some Facts[/u] Players = 2 Learning Time = ~20 minutes Playing Time = ~ 30 minutes - 1 hour You can view the rules here at my blog [url="http://subliminalman.wordpress.com/2012/05/23/lets-take-turns-playing-basketball/"]http://subliminalman...ing-basketball/[/url] or you could view the videos that accompany it directly on youtube [media]http://youtu.be/tkBCuU69X74[/media] [media]http://youtu.be/FKs1z-KXNyE[/media] If you want to get the pieces and board directly from here I attached them below (Note: scale to fit paper when printing for the player sprites) I am excited about this game and am looking forward to hearing feedback from the community! [attachment=9172:gamecourt.jpg] [url="http://subliminalman.files.wordpress.com/2012/05/basketsheet.png"]http://subliminalman...basketsheet.png[/url] (Sorry couldn't attach)
  5. The problem is when I put it to TEXCOORD1 it doesn't draw the thing at all. I'm trying to have it make a mask on the rendertarget to make it round.
  6. Hey all, I wrote this HLSL shader to create a mask from two textures. It works great on Windows but doesn't even want to compile for Xbox.Can someone tell me how to achieve the same effect so it could work both on Xbox and Windows. Here is the error I receive Error 1 Errors compiling C:\Users\Ryan\Desktop\ImFalling\ImFalling\ImFallingContent\Shaders\viewMask.fx: (19): error X3513: technique Technique1, pass Pass1: [b]Microcode Compiler Duplicated input semantics can't change type, size, or layout ('TEXCOORD0').[/b] [code] texture spherePort; texture mask; sampler TextureSamplerSphere = sampler_state { Texture = <spherePort>; }; sampler TextureSamplerMask = sampler_state { Texture = <mask>; }; //This is where I get the error float4 PixelShaderFunction(float2 TextureCoordinateSphere : TEXCOORD0, float2 TextureCoordinateMask :TEXCOORD0 ) : COLOR0 { return tex2D(TextureSamplerSphere, TextureCoordinateSphere) * tex2D(TextureSamplerMask, TextureCoordinateMask); } technique Technique1 { pass Pass1 { PixelShader = compile ps_2_0 PixelShaderFunction(); } } [/code] Any help would be most appreciated
  7. So here's my first Entry on this journal! My name is Ryan and I make games. Nothing too big at the moment but I will someday. Instead of doing a huge intro about me I thought I could just post some code that I did for my game Sky Cat that you can use for your XNA title (or if you port it to some other API). This code creates a "ViewFinder" for when a character goes off screen and you still want to see them. This code can be modified for whatever you are doing (in game map etc.). Here's the code! Please though just site me in the credits as a Special Thanks and let me know using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; class ViewFinder { #region Variables public bool isAlive = true; private float yPosition; private float seeRadius; private Point frameSize; private SpriteEffects spriteEffect = SpriteEffects.None; public Vector2 position; public Color viewFinderColor; private Matrix camera; private Camera2d cam, cam2; private Effect mask; private Texture2D pointer; private Texture2D lens; private Texture2D pointRender; private Texture2D maskTexture, finalMask, flippedFinalMask; private Texture2D texture; private RenderTarget2D renderTarget; private GraphicsDevice graphicsDevice; public PlayerIndex playerIndex; private FallingMan cat; static public bool[] playerView = new bool[4]; public RenderTarget2D finalTarget; public Texture2D finalTexture; #endregion #region Constructors public ViewFinder(Game game,Vector2 position, Texture2D texture, Point frameSize, Color viewFinderColor, GraphicsDevice graphicsDevice, PlayerIndex playerIndex) { mask = game.Content.Load(@"Shaders\viewMask"); pointer = game.Content.Load(@"Sprite\ViewFinder\pointer"); lens = game.Content.Load(@"Sprite\ViewFinder\lens"); maskTexture = game.Content.Load(@"Sprite\ViewFinder\mask"); cam = new Camera2d(); cam.Zoom = 3.5f; cam2 = new Camera2d(); cam2.Zoom = 6; this.position = position; this.viewFinderColor = viewFinderColor; this.texture = texture; this.frameSize = frameSize; seeRadius = this.frameSize.X; this.graphicsDevice = graphicsDevice; this.playerIndex = playerIndex; PresentationParameters pp = graphicsDevice.PresentationParameters; renderTarget = new RenderTarget2D(graphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, true, graphicsDevice.DisplayMode.Format, DepthFormat.Depth24); finalTarget = new RenderTarget2D(graphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, true, graphicsDevice.DisplayMode.Format, DepthFormat.Depth24); } #endregion #region Update public void Update(GameTime gameTime, Vector2 position, Matrix camera) { //Update Postion this.position = position; //Update Cam1 Position cam.position.X = position.X + (frameSize.X / 4); cam.position.Y = position.Y + (frameSize.Y / 2); if (position.Y < -camera.Translation.Y) { yPosition = 10; spriteEffect = SpriteEffects.FlipVertically; } else if (position.Y > -camera.Translation.Y) { yPosition = graphicsDevice.Viewport.Height - pointer.Height; } //Update Cam2 Position cam2.position.X = pointer.Width / 2; cam2.position.Y = pointer.Width / 2; this.camera = camera; } #endregion #region Draw //Call this first to draw the ViewFinder to a RenderTarget public void PreDraw(GameTime gameTime, SpriteBatch spriteBatch, params Object[] objects) { mask.CurrentTechnique = mask.Techniques["Technique1"]; graphicsDevice.SetRenderTarget(renderTarget); graphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; // Draw the scene graphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam.get_transformation(graphicsDevice)); spriteBatch.Draw(texture, new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height), Color.White); foreach (Object obj in objects) { if (obj is List) { foreach (Platform platform in ((List)obj)) { if (Math.Abs(platform.position.X - position.X) < seeRadius && Math.Abs(platform.position.Y - position.Y) < seeRadius) { platform.Draw(gameTime, spriteBatch); } } } else if (obj is List) { foreach (PowerUp powerUp in ((List)obj)) { if (Math.Abs(powerUp.position.X - position.X) < seeRadius && Math.Abs(powerUp.position.Y - position.Y) < seeRadius) { powerUp.Draw(gameTime, spriteBatch); } } } } spriteBatch.End(); graphicsDevice.SetRenderTarget(finalTarget); pointRender = (Texture2D)renderTarget; graphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, mask, camera); mask.Parameters["spherePort"].SetValue(pointRender); mask.Parameters["mask"].SetValue(maskTexture); spriteBatch.Draw(pointRender, new Rectangle(-50, -(int)camera.Translation.Y, pointRender.Width, pointRender.Height), Color.White); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam2.get_transformation(graphicsDevice)); spriteBatch.Draw(pointer, new Rectangle(-19, 0, pointer.Width +39, pointer.Height), null, viewFinderColor, 0.0f, Vector2.Zero, spriteEffect, 0.1f); spriteBatch.Draw(lens, new Rectangle(-19,0, lens.Width + 39, lens.Height), Color.White); spriteBatch.End(); graphicsDevice.SetRenderTarget(null); finalTexture = (Texture2D)finalTarget; } //Call this second to Mask the ViewFinder to have multiple on screen public void DrawViewFinder(GameTime gameTime, SpriteBatch spriteBatch) { spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, mask); mask.Parameters["spherePort"].SetValue(finalTexture); if (spriteEffect == SpriteEffects.None) { mask.Parameters["mask"].SetValue(finalMask); } else { mask.Parameters["mask"].SetValue(flippedFinalMask); } spriteBatch.Draw(finalTexture, new Rectangle((int)position.X, (int)yPosition, 100, 100), Color.White); spriteBatch.End(); } #endregion } And then here's the Mask HLSL Code texture spherePort; texture mask; sampler TextureSamplerSphere = sampler_state { Texture = ; }; sampler TextureSamplerMask = sampler_state { Texture = ; }; // TODO: add effect parameters here. float4 PixelShaderFunction(float2 TextureCoordinateSphere : TEXCOORD0, float2 TextureCoordinateMask :TEXCOORD0 ) : COLOR0 { // TODO: add your pixel shader code here. return tex2D(TextureSamplerSphere, TextureCoordinateSphere) * tex2D(TextureSamplerMask, TextureCoordinateMask); } technique Technique1 { pass Pass1 { // TODO: set renderstates here. PixelShader = compile ps_2_0 PixelShaderFunction(); } } I hope you all enjoy! Also check out Sky Cat on XBox Live Indie Games and PC when we release our 1.1 Update! Coming soon to Mac, iOS, and Android! Source: Using XNA RenderTargets
  8. [quote name='laztrezort' timestamp='1318794354' post='4873197'] As far as I know, there are just some performance considerations with the Xbox and rendertargets. In XNA 4 they apparently changed the interface so that behavior (but not performance!) is the same across platforms. The usual advice is to get something working first, then make a determination if optimization is needed. Of course, as I said, I'm not really the expert here, so maybe someone else can give a more detailed or accurate answer. [/quote] So I figured it out! Here's the code so if anyone is doing something like this they can use it! Please though just site me in the credits as a Special Thanks and let me know [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; class ViewFinder { #region Variables public bool isAlive = true; private float yPosition; private float seeRadius; private Point frameSize; private SpriteEffects spriteEffect = SpriteEffects.None; public Vector2 position; public Color viewFinderColor; private Matrix camera; private Camera2d cam, cam2; private Effect mask; private Texture2D pointer; private Texture2D lens; private Texture2D pointRender; private Texture2D maskTexture, finalMask, flippedFinalMask; private Texture2D texture; private RenderTarget2D renderTarget; private GraphicsDevice graphicsDevice; public PlayerIndex playerIndex; private FallingMan cat; static public bool[] playerView = new bool[4]; public RenderTarget2D finalTarget; public Texture2D finalTexture; #endregion #region Constructors public ViewFinder(Game game,Vector2 position, Texture2D texture, Point frameSize, Color viewFinderColor, GraphicsDevice graphicsDevice, PlayerIndex playerIndex) { mask = game.Content.Load<Effect>(@"Shaders\viewMask"); pointer = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\pointer"); lens = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\lens"); maskTexture = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\mask"); cam = new Camera2d(); cam.Zoom = 3.5f; cam2 = new Camera2d(); cam2.Zoom = 6; this.position = position; this.viewFinderColor = viewFinderColor; this.texture = texture; this.frameSize = frameSize; seeRadius = this.frameSize.X; this.graphicsDevice = graphicsDevice; this.playerIndex = playerIndex; PresentationParameters pp = graphicsDevice.PresentationParameters; renderTarget = new RenderTarget2D(graphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, true, graphicsDevice.DisplayMode.Format, DepthFormat.Depth24); finalTarget = new RenderTarget2D(graphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, true, graphicsDevice.DisplayMode.Format, DepthFormat.Depth24); } #endregion #region Update public void Update(GameTime gameTime, Vector2 position, Matrix camera) { //Update Postion this.position = position; //Update Cam1 Position cam.position.X = position.X + (frameSize.X / 4); cam.position.Y = position.Y + (frameSize.Y / 2); if (position.Y < -camera.Translation.Y) { yPosition = 10; spriteEffect = SpriteEffects.FlipVertically; } else if (position.Y > -camera.Translation.Y) { yPosition = graphicsDevice.Viewport.Height - pointer.Height; } //Update Cam2 Position cam2.position.X = pointer.Width / 2; cam2.position.Y = pointer.Width / 2; this.camera = camera; } #endregion #region Draw //Call this first to draw the ViewFinder to a RenderTarget public void PreDraw(GameTime gameTime, SpriteBatch spriteBatch, params Object[] objects) { mask.CurrentTechnique = mask.Techniques["Technique1"]; graphicsDevice.SetRenderTarget(renderTarget); graphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; // Draw the scene graphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam.get_transformation(graphicsDevice)); spriteBatch.Draw(texture, new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height), Color.White); foreach (Object obj in objects) { if (obj is List<Platform>) { foreach (Platform platform in ((List<Platform>)obj)) { if (Math.Abs(platform.position.X - position.X) < seeRadius && Math.Abs(platform.position.Y - position.Y) < seeRadius) { platform.Draw(gameTime, spriteBatch); } } } else if (obj is List<PowerUp>) { foreach (PowerUp powerUp in ((List<PowerUp>)obj)) { if (Math.Abs(powerUp.position.X - position.X) < seeRadius && Math.Abs(powerUp.position.Y - position.Y) < seeRadius) { powerUp.Draw(gameTime, spriteBatch); } } } } spriteBatch.End(); graphicsDevice.SetRenderTarget(finalTarget); pointRender = (Texture2D)renderTarget; graphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, mask, camera); mask.Parameters["spherePort"].SetValue(pointRender); mask.Parameters["mask"].SetValue(maskTexture); spriteBatch.Draw(pointRender, new Rectangle(-50, -(int)camera.Translation.Y, pointRender.Width, pointRender.Height), Color.White); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam2.get_transformation(graphicsDevice)); spriteBatch.Draw(pointer, new Rectangle(-19, 0, pointer.Width +39, pointer.Height), null, viewFinderColor, 0.0f, Vector2.Zero, spriteEffect, 0.1f); spriteBatch.Draw(lens, new Rectangle(-19,0, lens.Width + 39, lens.Height), Color.White); spriteBatch.End(); graphicsDevice.SetRenderTarget(null); finalTexture = (Texture2D)finalTarget; } //Call this second to Mask the ViewFinder to have multiple on screen public void DrawViewFinder(GameTime gameTime, SpriteBatch spriteBatch) { spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, mask); mask.Parameters["spherePort"].SetValue(finalTexture); if (spriteEffect == SpriteEffects.None) { mask.Parameters["mask"].SetValue(finalMask); } else { mask.Parameters["mask"].SetValue(flippedFinalMask); } spriteBatch.Draw(finalTexture, new Rectangle((int)position.X, (int)yPosition, 100, 100), Color.White); spriteBatch.End(); } #endregion } [/code] And then here's the Mask HLSL Code [code] texture spherePort; texture mask; sampler TextureSamplerSphere = sampler_state { Texture = <spherePort>; }; sampler TextureSamplerMask = sampler_state { Texture = <mask>; }; // TODO: add effect parameters here. float4 PixelShaderFunction(float2 TextureCoordinateSphere : TEXCOORD0, float2 TextureCoordinateMask :TEXCOORD0 ) : COLOR0 { // TODO: add your pixel shader code here. return tex2D(TextureSamplerSphere, TextureCoordinateSphere) * tex2D(TextureSamplerMask, TextureCoordinateMask); } technique Technique1 { pass Pass1 { // TODO: set renderstates here. PixelShader = compile ps_2_0 PixelShaderFunction(); } } [/code] Thanks for the Help
  9. No I haven't but doesnt that cause issues with the Xbox 360?
  10. Here's my ViewFinder Class, I tried to make it as self contained as possible but that may be the problem. I will also post up my draw code in the main game loop. ViewFinder [code] using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace ImFalling { class ViewFinder { #region Variables public bool isAlive = true; private float yPosition; private float seeRadius; private Point frameSize; private SpriteEffects spriteEffect = SpriteEffects.None; private Vector2 position; private Color viewFinderColor; private Matrix camera; private Camera2d cam; private Effect mask; private Texture2D pointer; private Texture2D lens; private Texture2D pointRender; private Texture2D maskTexture; private Texture2D texture; private RenderTarget2D renderTarget; private GraphicsDevice graphicsDevice; public PlayerIndex playerIndex; private FallingMan cat; static public bool[] playerView = new bool[4]; #endregion #region Constructors public ViewFinder(Game game,Vector2 position, Texture2D texture, Point frameSize, Color viewFinderColor, GraphicsDevice graphicsDevice, PlayerIndex playerIndex) { mask = game.Content.Load<Effect>(@"Shaders\viewMask"); pointer = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\pointer"); lens = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\lens"); maskTexture = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\mask"); cam = new Camera2d(); cam.Zoom = 3; this.position = position; this.viewFinderColor = viewFinderColor; this.texture = texture; this.frameSize = frameSize; seeRadius = this.frameSize.X; this.graphicsDevice = graphicsDevice; PresentationParameters pp = graphicsDevice.PresentationParameters; renderTarget = new RenderTarget2D(graphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, true, graphicsDevice.DisplayMode.Format, DepthFormat.Depth24); this.playerIndex = playerIndex; } public ViewFinder(Game game, FallingMan cat, GraphicsDevice graphicsDevice) { mask = game.Content.Load<Effect>(@"Shaders\viewMask"); pointer = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\pointer"); lens = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\lens"); maskTexture = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\mask"); cam = new Camera2d(); cam.Zoom = 3; position = cat.position; viewFinderColor = cat.color; texture = cat.texture; seeRadius = cat.frameSize.X; this.graphicsDevice = graphicsDevice; playerIndex = cat.p; this.cat = cat; PresentationParameters pp = graphicsDevice.PresentationParameters; renderTarget = new RenderTarget2D(graphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, true, graphicsDevice.DisplayMode.Format, DepthFormat.Depth24); Console.WriteLine(); for(int i = 0; i < 4; i++) Console.Write(playerView[i]); } #endregion #region Update public void Update(GameTime gameTime, Vector2 position, Matrix camera) { this.position = position; cam.position.X = position.X - (frameSize.X / 2); cam.position.Y = position.Y - (frameSize.Y / 2); this.camera = camera; } #endregion #region Draw public void Draw(GameTime gameTime, SpriteBatch spriteBatch, params Object[] objects) { //Draw either on top or on bottom of the screen if (position.Y < camera.Translation.Y) { yPosition = 10; spriteEffect = SpriteEffects.FlipVertically; } else if (position.Y > camera.Translation.Y + graphicsDevice.Viewport.Height) { yPosition = graphicsDevice.Viewport.Height - pointer.Height; } //Draw the off screen action mask.CurrentTechnique = mask.Techniques["Technique1"]; graphicsDevice.SetRenderTarget(renderTarget); graphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; // Draw the scene graphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam.get_transformation(graphicsDevice)); if (cat == null) { spriteBatch.Draw(texture, new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height), Color.White); } else { spriteBatch.Draw(texture, cat.position, new Rectangle(cat.currentFrame.X * frameSize.X, cat.currentFrame.Y * frameSize.Y, cat.frameSize.X, cat.frameSize.Y), Color.White, cat.rotation, Vector2.Zero, cat.scale, cat.flip, 0); //Console.WriteLine(cat.currentFrame); } foreach (Object obj in objects) { if (obj is List<Platform>) { foreach (Platform platform in ((List<Platform>)obj)) { if (Math.Abs(platform.position.X - position.X) < seeRadius && Math.Abs(platform.position.Y - position.Y) < seeRadius) { platform.Draw(gameTime, spriteBatch); } } } else if (obj is List<PowerUp>) { foreach (PowerUp powerUp in ((List<PowerUp>)obj)) { if (Math.Abs(powerUp.position.X - position.X) < seeRadius && Math.Abs(powerUp.position.Y - position.Y) < seeRadius) { powerUp.Draw(gameTime, spriteBatch); } } } else if (obj is List<Airplane>) { foreach (Airplane airPlane in ((List<Airplane>)obj)) { if (Math.Abs(airPlane.position.X - position.X) < seeRadius && Math.Abs(airPlane.position.Y - position.Y) < seeRadius) { airPlane.Draw(gameTime, spriteBatch); } } } else if (obj is List<Bird>) { foreach (Bird bird in ((List<Bird>)obj)) { if (Math.Abs(bird.position.X - position.X) < seeRadius && Math.Abs(bird.position.Y - position.Y) < seeRadius) { bird.Draw(gameTime, spriteBatch); } } } else if (obj is List<Fan>) { foreach (Fan fan in ((List<Fan>)obj)) { if (Math.Abs(fan.position.X - position.X) < seeRadius && Math.Abs(fan.position.Y - position.Y) < seeRadius) { fan.Draw(gameTime, spriteBatch); } } } else if (obj is List<Cloud>) { foreach (Cloud cloud in ((List<Cloud>)obj)) { if (Math.Abs(cloud.position.X - position.X) < seeRadius && Math.Abs(cloud.position.Y - position.Y) < seeRadius) { cloud.Draw(gameTime, spriteBatch); } } } else if (obj is List<FallingMan>) { foreach (FallingMan kitty in ((List<FallingMan>)obj)) { if (Math.Abs(kitty.position.X - position.X) < seeRadius && Math.Abs(kitty.position.Y - position.Y) < seeRadius && kitty.p != playerIndex) { kitty.Draw(gameTime, spriteBatch); } } } } spriteBatch.End(); graphicsDevice.SetRenderTarget(null); pointRender = (Texture2D)renderTarget; graphicsDevice.Clear(Color.CornflowerBlue); //Draw the scene to the screen and apply the mask to make it circular spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, mask, camera); mask.Parameters["spherePort"].SetValue(pointRender); mask.Parameters["mask"].SetValue(maskTexture); spriteBatch.Draw(pointRender, new Rectangle((int)position.X, (int)yPosition - (int)camera.Translation.Y, 100, 100), Color.White); spriteBatch.End(); //Draw the actual ViewFinder spriteBatch.Begin(); spriteBatch.Draw(pointer, new Vector2(position.X, yPosition), null, viewFinderColor, 0.0f, Vector2.Zero, 1.0f, spriteEffect, 0.1f); //spriteBatch.Draw(lens, new Vector2(position.X, yPosition), null, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.0f); spriteBatch.Draw(lens, new Rectangle((int)position.X, (int)yPosition, lens.Width, lens.Height), Color.White); spriteBatch.End(); } #endregion } } [/code] Main Game Draw Method [code] //Draw the Background protected override void Draw(GameTime gameTime) { spriteBatch.Begin(); myBackground.Draw(spriteBatch, Color.White); //color.blendedColor); spriteBatch.End(); cameraPosition += cameraSpeed; cameraMatrix = Matrix.CreateTranslation(0.0f, -cameraPosition + GraphicsDevice.Viewport.Height / 3 - 50, 0.0f); cloudExplosion.Draw(gameTime, spriteBatch, cameraMatrix); foreach (FallingMan cat in cats) { if (cat.velocity.Y >= 10) { UpdateCatFur(elapsed, cat); catFur.Draw(gameTime, spriteBatch); } } spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cameraMatrix); //Draw the cats foreach (FallingMan cat in cats) { if (cat.backGlow) { invulnExplosion.AddParticles(new Vector2(cat.collision.Center.X, cat.collision.Y)); if (cat.pulse <= 0) cat.count = true; if (cat.pulse >= 40) cat.count = false; if (cat.count) { if (cat.elapsedTimePulse >= timePulse) { cat.pulse++; elapsedTimePulse = 0; } } else { if (cat.elapsedTimePulse >= timePulse) { cat.pulse--; cat.elapsedTimePulse = 0; } } if (cat.flip == SpriteEffects.None) { cat.backPos.X = cat.collision.Center.X - ((pulse + cat.backGlowTexture.Width) / 2); cat.backPos.Y = cat.collision.Center.Y - (cat.backGlowTexture.Height / 2); } else { cat.backPos.X = (int)cat.position.X; } spriteBatch.Draw(cat.backGlowTexture, new Rectangle(cat.backPos.X, cat.backPos.Y, cat.frameSize.X + pulse, cat.frameSize.Y + pulse), Color.LightYellow); } } foreach (FallingMan cat in cats) { cat.Draw(gameTime, spriteBatch); } //Draw all the objects other then the player to the screen GraphicsDevice.BlendState = BlendState.AlphaBlend; foreach (Platform p in platforms) { p.Draw(gameTime, spriteBatch); } foreach (PowerUp pow in powerUps) { pow.Draw(gameTime, spriteBatch); } foreach (Airplane air in airPlanes) { air.Draw(gameTime, spriteBatch); } foreach (Bird bird in birds) { bird.Draw(gameTime, spriteBatch); } foreach (Fan fan in fans) { fan.Draw(gameTime, spriteBatch); } spriteBatch.End(); //Draw the ViewFinders foreach (ViewFinder view in viewFinders) { view.Draw(gameTime, spriteBatch, platforms, clouds, powerUps, birds, airPlanes); } } [/code] I'm experimenting with RenderTargets throughout the draw code also but I keep getting a purple screen when I do. Could that be because I might be doing a RenderTarget within a RenderTarget because of how the code is structured? Like [code] Graphics.SetRenderTarget2D(example1); Graphics.SetRenderTarget2D(example2); //Drawing stuff here Graphics.SetRenderTarget2D(null); [/code]
  11. Hi everyone! I'm working on what I call a ViewFinder for my game which acts much like the little "viewers" in Super Smash Bros. when your character goes off screen so you can still see them. I am having a few problems though [list=1][*]My background stops being drawn.[*]My Character does not animate within the ViewFinder.[*]Only one ViewFinder will be drawn at a time.[/list]I think it's with how I use RenderTargets within the ViewFinder class and not anywhere else in the Drawing Code. Since I'm still fairly new to RenderTargets and not drawing to the BackBuffer I'm a little at a loss. Any help would be appreciated thanks
  12. Sorry for the late reply another project took over me for a little while! I'm finding that I have a problem with the two objects pushing each other around horizontally. I know what code is doing it and its causing them to overlap and not perform behavior I intend. The problem is I dont have the slightest clue on how to perform the pushing of objects around properly. I want the two objects to be able to push each other around screen when bumping into each other. It somewhat does this with the code below but not as intended behavior. They overlap and they cannot fight over domination of who pushes based on their velocity because the one with the lesser velocity gets set by the greater so it can never actually win to push the opposite direction. Here's the code that I currently have for it. [code] foreach (FallingMan otherCat in cats) { #region test if (!otherCat.Equals(cat)) { if (Math.Abs((otherCat.position.X + (cat.texture.Width /2)) - (cat.position.X + (cat.texture.Width /2))) < 60 && Math.Abs((otherCat.position.Y + (cat.texture.Height / 2)) - (cat.position.Y + (cat.texture.Height / 2))) < 60)//Checking if bouncing into each other { //This is where it needs to be changed /* if (Math.Abs(otherCat.velocity.X) > Math.Abs(cat.velocity.X)) { cat.velocity.X = otherCat.velocity.X; } */ if (Math.Abs(otherCat.velocity.Y) > Math.Abs(cat.velocity.Y)) { cat.velocity.Y = otherCat.velocity.Y + 1; } } //FIGURE OUT HOW TO KEEP THEM FROM OVERLAPPING! if (otherCat.attackCollision.Intersects(cat.collision))//Checking for attacking { if (otherCat.position.X < cat.position.X) { cat.velocity.X += 10; } else { cat.velocity.X -= 10; } } } #endregion [/code] Again thank you so very much for any help
  13. Hey all, I'm currently working on a game with XNA. I'm having trouble modeling how two (or more) objects are supposed to react to each other when they collide against a wall. The best example of what I'm trying to do is if you have two boxes and you're trying to push them against a wall. -> [][]| What happens with mine is that one goes right through the other and they take up the same space. How would I go about modeling this in my code without having to use an outside physics library. Heres a picture to better illustrate of what I want. Thank you for any help
  14. whoops, I forgot to take out that / 180 on both of them! trampRotation is already in radians I'm still not having him go in the direction I want though.
  15. I have an object that is constantly falling using Velocity. What I want to be able to do is when the object hits a trampoline is send it flying in a direction based on the trampolines angle and if the trampoline is upside down make the object go flying down faster. I currently have something in place but it doesn't send the object the way I intend it to go so I feel that I'm just plain old doing it wrong. Any help would be appreciated. I also attached a picture diagramming what I intend Heres the code I have currently [code] if (trampTime <= 0) { character.velocity.Y = 10 * (float)Math.Sin(trampRotation / 180); //I know I shouldn't use velocity here, I was just experimenting to see what would work. character.velocity.X = 10 * (float)Math.Cos(trampRotation / 180); //convert to radians } trampTime++; if (trampTime > 30) { character.trampoline = false; trampTime = 0; } [/code]