How to make a scrolling background? - vb.net

I'm making a Shooter game like "1943" and "Jamestown". I was wondering how I would make the scrolling background to simulate moving forward and How would I make this efficient? I was thinking about using a animated GIF or to make a looping BitMap. Please could someone help me out.
Thanks!

Take a look at the XNA framework for game development to develop a game that will use the computer's resources efficiently for smooth gameplay and frame rates. There are a number of books and online tutorials available.
If you're wanting a quick and dirty vertical background scroll in a windows form, you could always place a panel control inside another panel, set the outer panel to not display scrollbars, and make the inner panel twice as tall (or more), and set the background texture of the inner panel to be the background image you want to display. You can then animate the inner panel to move from top to bottom and reset back to the top when it reaches the bottom. Also be sure to design your background image so that the view at the top and the view at the bottom are the same for a smooth transition when the panel gets reset. You'll also want to call panel.Refresh() when you move the panel.
All that said, the XNA framework is really the way to go for game development.

Related

How to build below screen in titanium?

below i attached an app help guide screen. I am understanding how to build this screen.
If any body have idea please share here
View with semi transparent background color (backgroundColor:"rgba(0,0,0,0.5)";) and some images on top of it.
So, using images is bad. You'll need images for translations and if you do this as one image you'll need to ensure all devices are covered so your arrows point to the right element.
Minimise images == smaller app.
First thing you'll need to do is a create a blocker view -- so that's a view that will fill the screen and have a black background with opacity.
You can't apply that to the window as everything in it will be semi-transparent so:
Create a transparent Window that fills the screen.
Add to that window a view that fills the window and has opacity say 0.5 and black background
Add to the Window (not the view you just created) the other elements and button -- ideally, these should be individual graphics of the arrows, sized in such a way that you can position them based on the host element (the item they are pointing to / referring to). Use real text so you can handle translations / reduce file size.
So you'll need a way to associate each tip with a control they are anchored too, and that will ensure that regardless of the screen size, the tip will appear in the correct place.
First of all, always give a try before putting questions anywhere because it makes you learn things on your own for long time.
The easiest step for you to do this is to ask your designer to create a complete image just like that & you just have to show it on top.
If you have to show that image in different translations, then you can ask your designer to provide you required translations images.

how can i implement dynamic navigation/group header positioning in a winrt app?

I know the title is a little confusing, but the best way to describe what I'm after is by running the Weather metro app on the Consumer Preview; as you scroll horizontally, you'll note that the section headings kind of move around and stay on top of the relevant content, and then fade out as you cross over into a new section. (The main background for the first section also kind of does this)
My question is, how would I go about replicating this behavior in a WinRT app of my own? Are there any existing controls I can leverage or would I have to essentially rewrite it all?
This looks just like a ScrollViewer - you would handle the ViewChanged event and depending on the scroll offset - change the opacity of overlaid static TextBlocks and completely hide the ones that scroll once you cross specific tresholds. I don't think there is anything like that that does it, but I can build it.

How to create an "Add to reading list" animation effect

I'm trying to make an animation effect similar to the one on Safari(iPhone) when you add an element to the reading list. It's similar to the one that appears when starting to download an item from App Store application: the application item drops to the dock to start downloading.
First it bounces up and then goes to the dock. It's a very nice effect that Apple uses on their OS.
I have an image view on screen that I want to drop with this kind of animation to my toolbar in my application.
If there is someone who did it or know what's the name of the effect, could please tell me how to do it.
Thank you.
"Add to reading list" shows no animation on my phone but of your description it sounds like the "Open in background"-animation in Safari (iPhone). My answer describes that animation.
I wrote a thing like that a few months ago and much of it is doable while some of it is not. Your questions showed me that more people are to know how it is done so I wrote a blog post about it. I will describe the high level approach and challenges here but you can read more about it in that post.
Getting to content to animate
If you choose to animate the view that is on screen down to the (in your case) tool bar then you will only have to access its layer. If you want the original view to remain and animate a visual copy (like the "open in background"-Safari animation) down to the bar item then you should create a new layer and draw the content of your layer into an image and set that image as the content of the layer that you are animating
Calculating the end position
The start position of the animation is simply the frame of the view. The end position is very tricky since bar items (both tool bar items and tab bar items) are not UIView subclasses and doesn't have a public view property. This causes problems when you want to shake the bar item later on.
I decided to make a visual approximation of the end position using some simple heuristics. If you know before hand that you will only animate to a single bar item then the end position can be hard coded to a suitable frame.
Animating along a path
There is nothing special to moving, scaling and rotating the layer from the start to the end position. If you want to read more about how I did it you can look at the post I wrote.
Shaking the bar item
This cannot be done without a lot of custom code or using private API at the moment. Since bar items doesn't have a view or a layer there is no accessible layer for you to animate. I guess that you could have a custom animating image that does the shake and set that during the animation and set the new image afterwards. The approach of drawing into an image and animating that doesn't work that well either since there is no accessible layer who can draw its content into the image (you want this for the special effect of the tool bar item and tab bar item).
...put all this together and tweak it to your special needs and you will have an animation that resembles the animation you are looking for.

Programmatically resizing and Scrolling NSView after application launch

I want to create a simple application which performs some calculations and then draws some images on view. I use NSBezierPath. Then I must resize the view and allow people scroll the finished picture. But i don't know how.If I also try to draw an image on an invisible part of canvas then it becomes invisible or isn't drawn (I couldn't know the future canvas size).
Check out the Apple sample code called BezierPathLab. I think that will get you started. There's lot of other sample code for Quartz 2D drawing too.
Being able to scroll and resize the view should be as simple as putting the view that you will be using to draw inside an NSScrollView.

Is it possible to overlay NS- controls on top of OpenGL?

In iOS development it's possible to overlay UIcontrols on top of a EAGLView, which basically makes you have interface controls on top of openGL.
I tried to achieve something similar with OSX development but it seems like the OpenGLView object is being drawn on top of everything regardless of its position in InterfaceBuilder.
In essence Im trying to show some OSX controls (buttons, sliders, etc..) on top of an OpenGLview. How can this be done?
I believe you may need to turn on layer-backed views (setWantsLayer:YES in code; a switch in the Core Animation properties in IB) for the controls you wish to layer and possibly the view containing the whole thing (the superview of the OpenGL view).
Also keep in mind controls that draw backgrounds, bezels, etc. You may need to configure each control to make sure it draws no backgrounds; buttons shouldn't use "momentary light" mode, etc.