Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 15th, 2012, 12:33 AM
IamRelativity77 IamRelativity77 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 1 IamRelativity77 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 16 sec
Reputation Power: 0
Making a small game in delphi, need help with movement.

I'm basically making a small game, it involves click and kill mechanics. The image must start off the screen (not visible) then it must move in a random direction onto the screen. Once it goes off the screen (or clicked) it will respawn again onto one of the sides (off the screen) and will again go in a random direction (one of 8 directions). A number will be added to the score, but this isn't really relevant (it's fairly easy to pull off). The image will also have random sizes (within a certain thresh-hold).

I tried to do this, several attempts at it actually, but I can't seem to get what I want to happen. Ive looked all over the internet and can't find a solution. I am a bit of a noob. The code for how to pull off some of this would be extremely helpful.

Thanks.

Reply With Quote
  #2  
Old June 20th, 2012, 12:22 AM
Luthfi Luthfi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 140 Luthfi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 4 h 53 m 15 sec
Reputation Power: 2
You must break down your problem into smaller ones and attack them one by one. Your current question is simply asking someone to finish the whole project for you.

Reply With Quote
  #3  
Old June 21st, 2012, 09:09 AM
peterbone peterbone is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 4 peterbone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m 59 sec
Reputation Power: 0
What you're talking about sounds like a sprite moving across an image. Store the sprite image in a TBitmap object. Put a TImage on the form. Use Canvas.Draw in TImage to draw the sprite bitmap at a given position. Use Canvas.CopyRect to erase the sprite from its previous position first (you can store another bitmap of the background). That should work but you may find that you get flickering. In that case use an off-screen bitmap and draw everything on that and then draw it directly on the form's canvas for each frame. That's the graphics side.
Use a TTimer for the animation and redraw the image in its ontimer event.
If you need keyboard controls then use GetKeyboardState.
Hope that helps a bit.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Making a small game in delphi, need help with movement.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap