Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

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:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old January 13th, 2008, 01:10 PM
madoka madoka is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 2 madoka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 50 sec
Reputation Power: 0
Unhappy Help, it keeps saying "image does not exist"!

I'm trying to code a game in Blitz Basic and when I tried to run it, it keeps popping up a window saying "image does not exist" and closes.

Can someone please tell me what is wrong with my coding and suggest how I might fix it? Thanks.

Quote:
;expe - RPG World

;set up graphics mode
Graphics 640,480,32

;Set automidhandle to true
AutoMidHandle True
;Set up Backbuffer
SetBuffer BackBuffer()

;IMAGES
;The close and quickly scrolled background
backgroundimageclose = LoadImage("starsfarther.bmp")

;The further and slowly scrolled background
backgroundimagefar = LoadImage("starry.bmp")

;Create scrolling tracker variable
scrolly = 0

;Play the music file and save its channel
backgroundmusic = PlayMusic("ff7theme.mp3")
If Not ChannelPlaying(backgroundmusic)
backgroundmusic = PlayMusic ("ff7theme.mp3")
EndIf

;TYPES

;Player type - holds the actual player
Type player
Field x,y ;the coordinates of the player
Field direction ;the direction that is being faced (one of the DIRECTIONXXX constants)
Field frame ;the frame that should be drawn
Field image ;the image that should be drawn
End Type

;Create player and initialize field
Global player.player = New player
player\x = 320
player\y = 240
player\direction = DIRECTIONLEFT
player\frame = 0
;load the player's image
playerimage = LoadAnimImage("cloudanim.bmp",19,37,0,4)

;CONSTANTS
;The following constants are used for testing key presses
Const ESCKEY = 1, LEFTKEY = 203, UPKEY = 200, RIGHTKEY = 205, DOWNKEY = 208, f10key = 68
;These constants define the direction that is begin faced
Const DIRECTIONLEFT = 1, DIRECTIONUP = 2, DIRECTIONRIGHT = 3, DIRECTIONDOWN = 4
;These constants define how many pixels are moved per frame
Const MOVEX = 5 ;how many pixels moved left/right per frame?
Const MOVEY = 5 ;how many pixels moved up/down per frame?

;Create a scrolling indicator variable
scrolly = 0

;MAIN LOOP
While Not KeyDown(ESCKEY)

;Clear the screen
Cls

;Tile both backgrounds at proper speed
TileImage backgroundimagefar,0,scrolly
TileImage backgroundimageclose,0,scrolly*2

;Increment scrolly
scrolly=scrolly+1

;Reset tracker variable if it gets too large
If scrolly >= ImageHeight(backgroundimageclose) And ImageHeight(backgroundimagefar) Then
scrolly = 0
EndIf


;if user presses f10, take a screenshot
If KeyHit(f10key)
SaveBuffer(FrontBuffer(), "screenshot" + snnum + ".bmp")
snnum = snnum + 1 ;add 1 to the end of the filename
EndIf
;screenshot number, begin at one (it is an integer)
snnum="1"

;If player hits left, move him left, and find the correct direction and frame
If KeyDown(LEFTKEY)
player\x = player\x - MOVEX ;move him left
player\direction = DIRECTIONLEFT ;face him left
player\frame = (player\frame + 1)Mod (1) + (1 * (player\direction)-1)
;find frame

;If player hits up, move him up, and find the correct direction and frame
ElseIf KeyDown(UPKEY)
player\y = player\y - MOVEY ;move him up
player\direction = DIRECTIONUP ;face him up
player\frame = (player\frame + 1)Mod (1) + (1 * (player\direction)-1)
;find frame

;If player hits right, move him right and find the correct direction and frame
ElseIf KeyDown(RIGHTKEY)
player\x = player\x + MOVEX ;move him right
player\direction = DIRECTIONRIGHT ;face him right
player\frame = (player\frame + 1)Mod (1) + (1 * (player\direction)-1)
;find frame

;If player hits down, move him down, and find the correct direction and frame
ElseIf KeyDown(DOWNKEY)
player\y = player\y + MOVEY ;move him down
player\direction = DIRECTIONDOWN ;face him down
player\frame = (player\frame + 1)Mod (1) + (1 * (player\direction)-1)
;find frame
EndIf

;draw the player at correct position and frame
DrawImage player\image,player\x,player\y, player\frame

;Wait a bit
Delay 50

;Flip the front and back buffers
Flip

Wend ;END OF MAIN LOOP

End

Reply With Quote
  #2  
Old January 13th, 2008, 01:18 PM
madoka madoka is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 2 madoka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 50 sec
Reputation Power: 0
Nevermind I just found out. =)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Help, it keeps saying "image does not exist"!


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway